From 8353d154c4e54e7bfac48950418cf7b336f8932c Mon Sep 17 00:00:00 2001 From: ro Date: Sun, 29 Sep 2024 16:34:52 -0600 Subject: [PATCH] DB edit: description to public_comments the update process now compiles public comments from instance blocklists and displays them, so the name of the table that stores these comments has been changed so it's not confusing. also made the appropriate changes on the backend and in the template that shows that information --- app/Http/Controllers/FrontIndexController.php | 2 +- app/Models/Location.php | 2 +- app/Services/UpdateService.php | 34 +++++++++---------- resources/views/back/location.blade.php | 2 ++ resources/views/front/location.blade.php | 2 +- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/app/Http/Controllers/FrontIndexController.php b/app/Http/Controllers/FrontIndexController.php index ce6409d..9154475 100644 --- a/app/Http/Controllers/FrontIndexController.php +++ b/app/Http/Controllers/FrontIndexController.php @@ -80,7 +80,7 @@ class FrontIndexController extends Controller } $links = explode(',', $location->archive_links); - $comments = explode('+', $location->description); + $comments = explode('+', $location->public_comments); return view('front.location', [ 'title' => str_replace(".", " ", $name), 'location' => $location, diff --git a/app/Models/Location.php b/app/Models/Location.php index a7a12cc..aeeb54d 100644 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -24,7 +24,7 @@ class Location extends Model "uuid", "name", "url", - "description", + "public_comments", "images", "active", "rating", diff --git a/app/Services/UpdateService.php b/app/Services/UpdateService.php index 60335bb..3acc94e 100644 --- a/app/Services/UpdateService.php +++ b/app/Services/UpdateService.php @@ -83,7 +83,7 @@ class UpdateService //clear out all previous descriptions foreach ($locations as $loc) { - $loc->description = ' '; + $loc->public_comments = ' '; $loc->save(); } @@ -101,9 +101,9 @@ class UpdateService $location->silence_vote = $item['silence_vote']; //clear descriptions if (!is_null($item['comment']) || !$item['comment'] != " ") { - $location->description = $item['comment']; + $location->public_comments = $item['comment']; } else { - $location->description = 'description pending'; + $location->public_comments = 'Comments Pending'; } $location->actions_count = $item['block_count'] + $item['silence_count']; @@ -131,20 +131,20 @@ class UpdateService } $new = Location::create([ - 'uuid' => Uuid::uuid4(), - 'name' => $item['url'], - 'url' => $item['url'], - 'description' => ($item['comment'] != null) ? $item['comment'] : "no description", - 'active' => $status, - 'rating' => $rating, - 'added_by' => 1, - 'tags' => 'poor moderation, hate speech', - 'images' => json_encode($images), - 'block_count' => $item['block_count'], - 'block_vote' => $item['block_vote'], - 'silence_count' => $item['silence_count'], - 'silence_vote' => $item['silence_vote'], - 'actions_cont' => $item['block_count'] + $item['silence_count'] + 'uuid' => Uuid::uuid4(), + 'name' => $item['url'], + 'url' => $item['url'], + 'public_comments' => ($item['comment'] != null) ? $item['comment'] : "comments pending", + 'active' => $status, + 'rating' => $rating, + 'added_by' => 1, + 'tags' => 'poor moderation, hate speech', + 'images' => json_encode($images), + 'block_count' => $item['block_count'], + 'block_vote' => $item['block_vote'], + 'silence_count' => $item['silence_count'], + 'silence_vote' => $item['silence_vote'], + 'actions_cont' => $item['block_count'] + $item['silence_count'] ]); } } diff --git a/resources/views/back/location.blade.php b/resources/views/back/location.blade.php index 86b4d46..03076c7 100644 --- a/resources/views/back/location.blade.php +++ b/resources/views/back/location.blade.php @@ -11,8 +11,10 @@ @csrf

+


diff --git a/resources/views/front/location.blade.php b/resources/views/front/location.blade.php index 5de5678..a1e131d 100644 --- a/resources/views/front/location.blade.php +++ b/resources/views/front/location.blade.php @@ -6,7 +6,7 @@ @parent
-

Description

+

Public Comments

@foreach($comments as $comment) @if($comment != " " && $comment != '') {{trim($comment)}}