From d3c45f91867ff4d36b044044efc4391d12c7d122 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 30 Nov 2019 23:15:28 -0500 Subject: [PATCH 1/3] Update type hint of System::jsonExit parameter to mixed - Output isn't necessarily an array --- src/Core/System.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/System.php b/src/Core/System.php index 0888f390a6..f367d28587 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -149,7 +149,7 @@ class System extends BaseObject * and adds an application/json HTTP header to the output. * After finishing the process is getting killed. * - * @param array $x The input content. + * @param mixed $x The input content. * @param string $content_type Type of the input (Default: 'application/json'). */ public static function jsonExit($x, $content_type = 'application/json') { From c3d88aca39a161c5adf30acf34144c4aac575ef1 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 30 Nov 2019 23:15:58 -0500 Subject: [PATCH 2/3] Update the return value of Item\Ignore to integer - Array is unnecessary --- src/Module/Item/Ignore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Item/Ignore.php b/src/Module/Item/Ignore.php index 4590bc8c84..e67f2113cd 100644 --- a/src/Module/Item/Ignore.php +++ b/src/Module/Item/Ignore.php @@ -73,6 +73,6 @@ class Ignore extends BaseModule } // the json doesn't really matter, it will either be 0 or 1 - System::jsonExit([$ignored]); + System::jsonExit($ignored); } } From d01d69b9e72360b0b19c2618b3c3504704ea83da Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 30 Nov 2019 23:16:34 -0500 Subject: [PATCH 3/3] Update doignore() in main.js to match new Item\Ignore return type - Remove superfluous jQuery selectors --- view/js/main.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/view/js/main.js b/view/js/main.js index e15ee77e19..37975dd338 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -649,14 +649,16 @@ function doignore(ident) { ident = ident.toString(); $('#like-rotator-' + ident).show(); $.get('item/ignore/' + ident, function(data) { - if (data.match(/1/)) { - $('#ignored-' + ident).addClass('ignored'); - $('#ignored-' + ident).removeClass('unignored'); + if (data === 1) { + $('#ignored-' + ident) + .addClass('ignored') + .removeClass('unignored'); $('#ignore-' + ident).addClass('hidden'); $('#unignore-' + ident).removeClass('hidden'); } else { - $('#ignored-' + ident).addClass('unignored'); - $('#ignored-' + ident).removeClass('ignored'); + $('#ignored-' + ident) + .addClass('unignored') + .removeClass('ignored'); $('#ignore-' + ident).removeClass('hidden'); $('#unignore-' + ident).addClass('hidden'); }