mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-01-22 07:59:47 +00:00
Merge pull request 'Ratioed: several fixes to functionality' (#1586) from mexon/friendica-addons:mat/ratioed-fixes into develop
Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1586
This commit is contained in:
commit
44d2079da2
3 changed files with 21 additions and 63 deletions
|
@ -24,7 +24,6 @@ class RatioedPanel extends Active
|
||||||
return Renderer::replaceMacros($template, array('$config' => DI::baseUrl() . '/settings/addon'));
|
return Renderer::replaceMacros($template, array('$config' => DI::baseUrl() . '/settings/addon'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = $this->parameters['action'] ?? '';
|
|
||||||
$uid = $this->parameters['uid'] ?? 0;
|
$uid = $this->parameters['uid'] ?? 0;
|
||||||
$user = [];
|
$user = [];
|
||||||
|
|
||||||
|
@ -32,31 +31,10 @@ class RatioedPanel extends Active
|
||||||
$user = User::getById($uid, ['username', 'blocked']);
|
$user = User::getById($uid, ['username', 'blocked']);
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
$this->systemMessages->addNotice($this->t('User not found'));
|
$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);
|
$pager = new Pager($this->l10n, $this->args->getQueryString(), 100);
|
||||||
|
|
||||||
$valid_orders = [
|
$valid_orders = [
|
||||||
|
@ -69,9 +47,9 @@ class RatioedPanel extends Active
|
||||||
];
|
];
|
||||||
|
|
||||||
$order = 'last-item';
|
$order = 'last-item';
|
||||||
$order_direction = '-';
|
$order_direction = '+';
|
||||||
if (!empty($request['o'])) {
|
if (!empty($_REQUEST['o'])) {
|
||||||
$new_order = $request['o'];
|
$new_order = $_REQUEST['o'];
|
||||||
if ($new_order[0] === '-') {
|
if ($new_order[0] === '-') {
|
||||||
$order_direction = '-';
|
$order_direction = '-';
|
||||||
$new_order = substr($new_order, 1);
|
$new_order = substr($new_order, 1);
|
||||||
|
@ -175,8 +153,10 @@ class RatioedPanel extends Active
|
||||||
$user['ratioed'] = (float)($user['ratio']) >= 2.0;
|
$user['ratioed'] = (float)($user['ratio']) >= 2.0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$user['reactions'] = 0;
|
||||||
if ($user['comments'] == 0) {
|
if ($user['comments'] == 0) {
|
||||||
$user['ratio'] = '0';
|
$user['comments'] = 0;
|
||||||
|
$user['ratio'] = 0;
|
||||||
$user['ratioed'] = false;
|
$user['ratioed'] = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* Name: Ratioed
|
* Name: Ratioed
|
||||||
* Description: Additional moderation user table with statistics about user behaviour
|
* Description: Additional moderation user table with statistics about user behaviour
|
||||||
* Version: 0.1
|
* Version: 0.2
|
||||||
* Author: Matthew Exon <http://mat.exon.name>
|
* Author: Matthew Exon <http://mat.exon.name>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -2,26 +2,21 @@
|
||||||
<link rel="stylesheet" href="view/theme/frio/css/mod_admin.css?v={{constant('\Friendica\App::VERSION')}}" type="text/css" media="screen"/>
|
<link rel="stylesheet" href="view/theme/frio/css/mod_admin.css?v={{constant('\Friendica\App::VERSION')}}" type="text/css" media="screen"/>
|
||||||
|
|
||||||
<div id="admin-users" class="adminpage generic-page-wrapper">
|
<div id="admin-users" class="adminpage generic-page-wrapper">
|
||||||
<h1>{{$title}} - {{$page}} ({{$count}})</h1>
|
<h1>
|
||||||
<p>
|
{{$title}} - {{$page}} ({{$count}})
|
||||||
<a href="{{$base_url}}/moderation/users/create" class="btn btn-primary"><i class="fa fa-user-plus"></i> {{$h_newuser}}</a>
|
<a href="{{$base_url}}/ratioed/help"><i style="float: right; font-size: 60%" class="fa fa-question-circle fa-fw" aria-hidden="true"></i></a>
|
||||||
</p>
|
</h1>
|
||||||
<form action="{{$baseurl}}/{{$query_string}}" method="post">
|
<form action="{{$baseurl}}/{{$query_string}}" method="post">
|
||||||
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
|
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
|
||||||
<table id="users" class="table table-hover">
|
<table id="users" class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th></th>
|
||||||
<div class="checkbox">
|
|
||||||
<input type="checkbox" id="admin-settings-users-select" class="selecttoggle" data-select-class="users_ckbx"/>
|
|
||||||
<label for="admin-settings-users-select"></label>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
<th></th>
|
<th></th>
|
||||||
{{foreach $th_users as $k=>$th}}
|
{{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])) }}
|
||||||
<th class="th-{{$k}}">
|
<th class="th-{{$k}}">
|
||||||
<a href="{{$baseurl}}/moderation/users/active?o={{if $order_direction_users == "+"}}-{{/if}}{{$th.1}}" class="table-order">
|
<a href="{{$baseurl}}/ratioed?o={{if $order_direction_users == "+"}}-{{/if}}{{$th.1}}" class="table-order">
|
||||||
{{if $order_users == $th.1}}
|
{{if $order_users == $th.1}}
|
||||||
{{if $order_direction_users == "+"}}
|
{{if $order_direction_users == "+"}}
|
||||||
↓
|
↓
|
||||||
|
@ -42,16 +37,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{{foreach $users as $u}}
|
{{foreach $users as $u}}
|
||||||
<tr id="user-{{$u.uid}}" class="{{if $u.ratioed}}blocked{{/if}}">
|
<tr id="user-{{$u.uid}}" class="{{if $u.ratioed}}blocked{{/if}}">
|
||||||
<td>
|
<td></td>
|
||||||
{{if $u.is_deletable}}
|
|
||||||
<div class="checkbox">
|
|
||||||
<input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/>
|
|
||||||
<label for="id_user_{{$u.uid}}"></label>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
<td><img class="avatar-nano" src="{{$u.micro}}" title="{{$u.nickname}}"></td>
|
<td><img class="avatar-nano" src="{{$u.micro}}" title="{{$u.nickname}}"></td>
|
||||||
<td><a href="{{$u.url}}" title="{{$u.nickname}}"> {{$u.name}}</a></td>
|
<td><a href="{{$u.url}}" title="{{$u.nickname}}"> {{$u.name}}</a></td>
|
||||||
<td>{{$u.email}}</td>
|
<td>{{$u.email}}</td>
|
||||||
|
@ -63,11 +49,7 @@
|
||||||
<td>{{$u.login_date}}</td>
|
<td>{{$u.login_date}}</td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $order_users == $th_users.4.1}}
|
{{if $order_users == $th_users.5.1}}
|
||||||
<td>{{$u.lastitem_date}}</td>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{if !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1]) }}
|
|
||||||
<td>
|
<td>
|
||||||
<i class="fa
|
<i class="fa
|
||||||
{{if $u.page_flags_raw==0}}fa-user{{/if}} {{* PAGE_NORMAL *}}
|
{{if $u.page_flags_raw==0}}fa-user{{/if}} {{* PAGE_NORMAL *}}
|
||||||
|
@ -91,6 +73,10 @@
|
||||||
</td>
|
</td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{if !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.5.1]) }}
|
||||||
|
<td>{{$u.lastitem_date}}</td>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<button type="button" class="btn-link admin-settings-action-link" onclick="return details({{$u.uid}})"><span class="caret"></span></button>
|
<button type="button" class="btn-link admin-settings-action-link" onclick="return details({{$u.uid}})"><span class="caret"></span></button>
|
||||||
</td>
|
</td>
|
||||||
|
@ -151,14 +137,6 @@
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="panel-footer">
|
|
||||||
<button type="submit" name="page_users_block" value="1" class="btn btn-warning">
|
|
||||||
<i class="fa fa-ban" aria-hidden="true"></i> {{$block}}
|
|
||||||
</button>
|
|
||||||
<button type="submit" name="page_users_delete" value="1" class="btn btn-danger" onclick="return confirm_delete('{{$confirm_delete_multi}}')">
|
|
||||||
<i class="fa fa-trash" aria-hidden="true"></i> {{$delete}}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{{$pager nofilter}}
|
{{$pager nofilter}}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue