From 4a341dc40d5251e6ca1a85c5ddb1381dd6988e1b Mon Sep 17 00:00:00 2001 From: ro Date: Sun, 12 Nov 2023 12:22:22 -0600 Subject: [PATCH] Quote clean up CSV export, tweaking action counts https://tenforward.social/@noracodes reported an issue with the CSV not rendering properly because of the mix of single and double quotes, so that's been cleaned up. Also fixed action sorting which was reversed. --- app/Http/Controllers/ExportController.php | 2 ++ app/Http/Controllers/LocationController.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php index fcf17a6..5dd703b 100644 --- a/app/Http/Controllers/ExportController.php +++ b/app/Http/Controllers/ExportController.php @@ -41,8 +41,10 @@ class ExportController extends Controller if ($type == 'mastodon') { //comman break teh CSV so just take them out $comments = str_replace(",", ";", $location->description); + //remove extra white space $comments = str_replace(["\n\r", "\n", "\r"], " ", $comments); + $comments = str_replace(['"', "'"], "", $comments); //add to the export list array_push($list, [$location->url, $location->rating, $comments, "FALSE", "FALSE", "FALSE"]); } diff --git a/app/Http/Controllers/LocationController.php b/app/Http/Controllers/LocationController.php index 51d8ada..e8ff44a 100644 --- a/app/Http/Controllers/LocationController.php +++ b/app/Http/Controllers/LocationController.php @@ -81,9 +81,9 @@ class LocationController extends Controller $silence = 0; $suspend = 0; if ($item['severity'] == "suspend" || $item['severity'] == "defederate") { - ++$silence; - } else { ++$suspend; + } else { + ++$silence; } array_push($unified, [ 'name' => $item['domain'],