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
This commit is contained in:
ro 2024-09-29 16:34:52 -06:00
parent 098cd72186
commit 8353d154c4
5 changed files with 22 additions and 20 deletions

View file

@ -80,7 +80,7 @@ class FrontIndexController extends Controller
} }
$links = explode(',', $location->archive_links); $links = explode(',', $location->archive_links);
$comments = explode('+', $location->description); $comments = explode('+', $location->public_comments);
return view('front.location', [ return view('front.location', [
'title' => str_replace(".", " ", $name), 'title' => str_replace(".", " ", $name),
'location' => $location, 'location' => $location,

View file

@ -24,7 +24,7 @@ class Location extends Model
"uuid", "uuid",
"name", "name",
"url", "url",
"description", "public_comments",
"images", "images",
"active", "active",
"rating", "rating",

View file

@ -83,7 +83,7 @@ class UpdateService
//clear out all previous descriptions //clear out all previous descriptions
foreach ($locations as $loc) { foreach ($locations as $loc) {
$loc->description = ' '; $loc->public_comments = ' ';
$loc->save(); $loc->save();
} }
@ -101,9 +101,9 @@ class UpdateService
$location->silence_vote = $item['silence_vote']; $location->silence_vote = $item['silence_vote'];
//clear descriptions //clear descriptions
if (!is_null($item['comment']) || !$item['comment'] != " ") { if (!is_null($item['comment']) || !$item['comment'] != " ") {
$location->description = $item['comment']; $location->public_comments = $item['comment'];
} else { } else {
$location->description = 'description pending'; $location->public_comments = 'Comments Pending';
} }
$location->actions_count = $item['block_count'] + $item['silence_count']; $location->actions_count = $item['block_count'] + $item['silence_count'];
@ -131,20 +131,20 @@ class UpdateService
} }
$new = Location::create([ $new = Location::create([
'uuid' => Uuid::uuid4(), 'uuid' => Uuid::uuid4(),
'name' => $item['url'], 'name' => $item['url'],
'url' => $item['url'], 'url' => $item['url'],
'description' => ($item['comment'] != null) ? $item['comment'] : "no description", 'public_comments' => ($item['comment'] != null) ? $item['comment'] : "comments pending",
'active' => $status, 'active' => $status,
'rating' => $rating, 'rating' => $rating,
'added_by' => 1, 'added_by' => 1,
'tags' => 'poor moderation, hate speech', 'tags' => 'poor moderation, hate speech',
'images' => json_encode($images), 'images' => json_encode($images),
'block_count' => $item['block_count'], 'block_count' => $item['block_count'],
'block_vote' => $item['block_vote'], 'block_vote' => $item['block_vote'],
'silence_count' => $item['silence_count'], 'silence_count' => $item['silence_count'],
'silence_vote' => $item['silence_vote'], 'silence_vote' => $item['silence_vote'],
'actions_cont' => $item['block_count'] + $item['silence_count'] 'actions_cont' => $item['block_count'] + $item['silence_count']
]); ]);
} }
} }

View file

@ -11,8 +11,10 @@
@csrf @csrf
<label>Edit Location Name</label><br> <label>Edit Location Name</label><br>
<input type="text" name="name" value="{{$location->name}}" /><br> <input type="text" name="name" value="{{$location->name}}" /><br>
<!--
<label>Edit Location Comments</label><br> <label>Edit Location Comments</label><br>
<textarea name="description">{{$location->description}}</textarea><br> <textarea name="description">{{$location->description}}</textarea><br>
-->
<label>Edit Reference Links (comma seperated)</label><br> <label>Edit Reference Links (comma seperated)</label><br>
<textarea name="archive_links">{{$location->archive_links}}</textarea><br> <textarea name="archive_links">{{$location->archive_links}}</textarea><br>
<label>Edit Reference Images</label><br> <label>Edit Reference Images</label><br>

View file

@ -6,7 +6,7 @@
@parent @parent
<section> <section>
<article> <article>
<h2>Description</h2> <h2>Public Comments</h2>
@foreach($comments as $comment) @foreach($comments as $comment)
@if($comment != " " && $comment != '') @if($comment != " " && $comment != '')
{{trim($comment)}}<br /><br /> {{trim($comment)}}<br /><br />