From d034e311cbe5c45f808baf0c88efd88c484acd76 Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Sun, 5 Jan 2025 21:51:37 +0100 Subject: [PATCH 1/7] Ratioed: add help link --- ratioed/templates/ratioed.tpl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ratioed/templates/ratioed.tpl b/ratioed/templates/ratioed.tpl index 0d81b0d7..5d92bff2 100644 --- a/ratioed/templates/ratioed.tpl +++ b/ratioed/templates/ratioed.tpl @@ -2,7 +2,10 @@
-

{{$title}} - {{$page}} ({{$count}})

+

+ {{$title}} - {{$page}} ({{$count}}) + +

{{$h_newuser}}

From 8e65141cb5e04be141ee0489d28aa8be62155553 Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Sun, 5 Jan 2025 21:57:18 +0100 Subject: [PATCH 2/7] Ratioed: bump version number --- ratioed/ratioed.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ratioed/ratioed.php b/ratioed/ratioed.php index 8ae0d48c..581ef89b 100644 --- a/ratioed/ratioed.php +++ b/ratioed/ratioed.php @@ -2,7 +2,7 @@ /** * Name: Ratioed * Description: Additional moderation user table with statistics about user behaviour - * Version: 0.1 + * Version: 0.2 * Author: Matthew Exon */ From 2ef9cb8add8bc28a5d6dea9f40276abea2814d97 Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Sat, 11 Jan 2025 19:36:06 +0100 Subject: [PATCH 3/7] Ratioed: fill in zeroes for empty values --- ratioed/RatioedPanel.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ratioed/RatioedPanel.php b/ratioed/RatioedPanel.php index bd9b44dc..dac71752 100644 --- a/ratioed/RatioedPanel.php +++ b/ratioed/RatioedPanel.php @@ -175,8 +175,10 @@ class RatioedPanel extends Active $user['ratioed'] = (float)($user['ratio']) >= 2.0; } else { + $user['reactions'] = 0; if ($user['comments'] == 0) { - $user['ratio'] = '0'; + $user['comments'] = 0; + $user['ratio'] = 0; $user['ratioed'] = false; } else { From d495810b2daf9e278cf317df9a12702b136d131c Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Sat, 11 Jan 2025 19:36:38 +0100 Subject: [PATCH 4/7] Ratioed: allow both sorting directions --- ratioed/RatioedPanel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ratioed/RatioedPanel.php b/ratioed/RatioedPanel.php index dac71752..08d94167 100644 --- a/ratioed/RatioedPanel.php +++ b/ratioed/RatioedPanel.php @@ -70,10 +70,10 @@ class RatioedPanel extends Active $order = 'last-item'; $order_direction = '-'; - if (!empty($request['o'])) { - $new_order = $request['o']; - if ($new_order[0] === '-') { - $order_direction = '-'; + if (!empty($_REQUEST['o'])) { + $new_order = $_REQUEST['o']; + if ($new_order[0] === '+') { + $order_direction = '+'; $new_order = substr($new_order, 1); } From 81639ff61574c38769c3693bec6054b1b27bfefc Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Sat, 11 Jan 2025 19:38:29 +0100 Subject: [PATCH 5/7] Ratioed: fix sorting by columns --- ratioed/templates/ratioed.tpl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ratioed/templates/ratioed.tpl b/ratioed/templates/ratioed.tpl index 5d92bff2..d634993e 100644 --- a/ratioed/templates/ratioed.tpl +++ b/ratioed/templates/ratioed.tpl @@ -22,9 +22,9 @@ {{foreach $th_users as $k=>$th}} - {{if $k < 2 || $order_users == $th.1 || ($k==5 && !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1])) }} + {{if $k < 2 || $order_users == $th.1 || ($k==4 && !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.5.1])) }} - + {{if $order_users == $th.1}} {{if $order_direction_users == "+"}} ↓ @@ -66,11 +66,7 @@ {{$u.login_date}} {{/if}} - {{if $order_users == $th_users.4.1}} - {{$u.lastitem_date}} - {{/if}} - - {{if !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1]) }} + {{if $order_users == $th_users.5.1}} From 46b38367209b8c5c6f084454d5a9ea9eb322a8d9 Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Sat, 11 Jan 2025 19:39:20 +0100 Subject: [PATCH 6/7] Ratioed: remove create user button --- ratioed/templates/ratioed.tpl | 3 --- 1 file changed, 3 deletions(-) diff --git a/ratioed/templates/ratioed.tpl b/ratioed/templates/ratioed.tpl index d634993e..c64cb1dc 100644 --- a/ratioed/templates/ratioed.tpl +++ b/ratioed/templates/ratioed.tpl @@ -6,9 +6,6 @@ {{$title}} - {{$page}} ({{$count}}) -

- {{$h_newuser}} -

From b360b553eddf3a7ad01c06f7b050b1a69734cdc7 Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Sat, 11 Jan 2025 20:07:18 +0100 Subject: [PATCH 7/7] Ratioed: remove actions --- ratioed/RatioedPanel.php | 30 ++++-------------------------- ratioed/templates/ratioed.tpl | 26 ++------------------------ 2 files changed, 6 insertions(+), 50 deletions(-) diff --git a/ratioed/RatioedPanel.php b/ratioed/RatioedPanel.php index 08d94167..19f6dd44 100644 --- a/ratioed/RatioedPanel.php +++ b/ratioed/RatioedPanel.php @@ -24,7 +24,6 @@ class RatioedPanel extends Active return Renderer::replaceMacros($template, array('$config' => DI::baseUrl() . '/settings/addon')); } - $action = $this->parameters['action'] ?? ''; $uid = $this->parameters['uid'] ?? 0; $user = []; @@ -32,31 +31,10 @@ class RatioedPanel extends Active $user = User::getById($uid, ['username', 'blocked']); if (!$user) { $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); + $this->baseUrl->redirect('ratioed'); } } - switch ($action) { - case 'delete': - if ($this->session->getLocalUserId() != $uid) { - self::checkFormSecurityTokenRedirectOnError('moderation/users/active', 'moderation_users_active', 't'); - // delete user - User::remove($uid); - - $this->systemMessages->addNotice($this->t('User "%s" deleted', $user['username'])); - } else { - $this->systemMessages->addNotice($this->t('You can\'t remove yourself')); - } - - $this->baseUrl->redirect('moderation/users/active'); - break; - case 'block': - self::checkFormSecurityTokenRedirectOnError('moderation/users/active', 'moderation_users_active', 't'); - User::block($uid); - $this->systemMessages->addNotice($this->t('User "%s" blocked', $user['username'])); - $this->baseUrl->redirect('moderation/users/active'); - break; - } $pager = new Pager($this->l10n, $this->args->getQueryString(), 100); $valid_orders = [ @@ -69,11 +47,11 @@ class RatioedPanel extends Active ]; $order = 'last-item'; - $order_direction = '-'; + $order_direction = '+'; if (!empty($_REQUEST['o'])) { $new_order = $_REQUEST['o']; - if ($new_order[0] === '+') { - $order_direction = '+'; + if ($new_order[0] === '-') { + $order_direction = '-'; $new_order = substr($new_order, 1); } diff --git a/ratioed/templates/ratioed.tpl b/ratioed/templates/ratioed.tpl index c64cb1dc..24ae20b8 100644 --- a/ratioed/templates/ratioed.tpl +++ b/ratioed/templates/ratioed.tpl @@ -11,12 +11,7 @@
- + {{foreach $th_users as $k=>$th}} {{if $k < 2 || $order_users == $th.1 || ($k==4 && !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.5.1])) }} @@ -42,16 +37,7 @@ {{foreach $users as $u}} - + @@ -151,14 +137,6 @@ {{/foreach}}
-
- - -
-
- {{if $u.is_deletable}} -
- - -
- {{else}} -   - {{/if}} -
{{$u.name}} {{$u.email}}
- {{$pager nofilter}}