mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:55:15 +00:00
add moderation queue to notifications
This commit is contained in:
parent
f3657d4835
commit
6e98093381
6 changed files with 81 additions and 4 deletions
|
@ -447,6 +447,45 @@ class Ping extends Controller
|
|||
json_return_and_die(['notify' => $local_result]);
|
||||
}
|
||||
|
||||
if (argc() > 1 && (argv(1) === 'moderate')) {
|
||||
$local_result = [];
|
||||
|
||||
$sql_extra .= " and item_wall = 1 ";
|
||||
$item_normal_moderate = item_normal_moderate();
|
||||
|
||||
$loadtime = get_loadtime('channel');
|
||||
|
||||
$r = q(
|
||||
"SELECT * FROM item
|
||||
WHERE uid = %d
|
||||
AND author_xchan != '%s'
|
||||
$seenstr
|
||||
$approvals
|
||||
$item_normal_moderate
|
||||
$sql_extra
|
||||
AND item_blocked = 4
|
||||
ORDER BY created DESC
|
||||
LIMIT 300",
|
||||
intval(local_channel()),
|
||||
dbesc($ob_hash)
|
||||
);
|
||||
if ($r) {
|
||||
xchan_query($r);
|
||||
foreach ($r as $item) {
|
||||
$z = Enotify::format($item);
|
||||
|
||||
if ($z) {
|
||||
$z['notify_link'] = str_replace('/display/','/moderate/', $z['notify_link']);
|
||||
$local_result[] = $z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
json_return_and_die(['notify' => $local_result]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((argc() > 1 && (argv(1) === 'register')) && is_site_admin()) {
|
||||
$result = [];
|
||||
|
||||
|
@ -663,6 +702,15 @@ class Ping extends Controller
|
|||
$result['home'] = 0;
|
||||
}
|
||||
|
||||
if ($vnotify & VNOTIFY_MODERATE) {
|
||||
$mods = q("SELECT COUNT(id) AS total from item where uid = %d and item_blocked = %d",
|
||||
intval(local_channel()),
|
||||
intval(ITEM_MODERATED)
|
||||
);
|
||||
if ($mods) {
|
||||
$result['moderate'] = intval($mods[0]['total']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($vnotify & VNOTIFY_INTRO) {
|
||||
$intr = q(
|
||||
|
|
|
@ -127,7 +127,7 @@ class Channel
|
|||
$notify += intval($_POST['notify' . $x]);
|
||||
}
|
||||
}
|
||||
for ($x = 1; $x <= 16; $x++) {
|
||||
for ($x = 1; $x <= 17; $x++) {
|
||||
if(isset($_POST['vnotify' . $x])) {
|
||||
$vnotify += intval($_POST['vnotify' . $x]);
|
||||
}
|
||||
|
@ -518,6 +518,7 @@ class Channel
|
|||
'$vnotify14' => ['vnotify14', t('Unseen likes and dislikes'), ($vnotify & VNOTIFY_LIKE), VNOTIFY_LIKE, '', $yes_no],
|
||||
'$vnotify15' => ['vnotify15', t('Unseen group posts'), ($vnotify & VNOTIFY_FORUMS), VNOTIFY_FORUMS, '', $yes_no],
|
||||
'$vnotify16' => ((is_site_admin()) ? ['vnotify16', t('Reported content'), ($vnotify & VNOTIFY_REPORTS), VNOTIFY_REPORTS, '', $yes_no] : []),
|
||||
'$vnotify17' => ['vnotify17', t('Moderated Activities'), ($vnotify & VNOTIFY_MODERATE), VNOTIFY_MODERATE, t('Recommended'), $yes_no],
|
||||
'$desktop_notifications_info' => t('Desktop notifications are unavailable because the required browser permission has not been granted'),
|
||||
'$desktop_notifications_request' => t('Grant permission'),
|
||||
'$mailhost' => ['mailhost', t('Email notifications sent from (hostname)'), get_pconfig(local_channel(), 'system', 'email_notify_host', App::get_hostname()), sprintf(t('If your channel is mirrored to multiple locations, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'), App::get_hostname())],
|
||||
|
|
|
@ -53,6 +53,22 @@ class Notifications implements WidgetInterface
|
|||
]
|
||||
];
|
||||
|
||||
$notifications[] = [
|
||||
'type' => 'moderate',
|
||||
'icon' => 'home',
|
||||
'severity' => 'danger',
|
||||
'label' => t('New Moderated Entries'),
|
||||
'title' => t('New Moderated Activities'),
|
||||
'viewall' => [
|
||||
'url' => 'moderate',
|
||||
'label' => t('View moderation queue')
|
||||
],
|
||||
'markall' => [
|
||||
'label' => t('Mark all notifications seen')
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
$notifications[] = [
|
||||
'type' => 'all_events',
|
||||
'icon' => 'calendar',
|
||||
|
|
|
@ -621,7 +621,7 @@ function notificationsUpdate(cached_data) {
|
|||
}
|
||||
|
||||
function handleNotifications(data) {
|
||||
if(data.stream || data.home || data.intros || data.register || data.mail || data.all_events || data.notify || data.files || data.pubs || data.forums) {
|
||||
if(data.stream || data.home || data.intros || data.register || data.mail || data.all_events || data.notify || data.files || data.pubs || data.forums || data.moderate) {
|
||||
$('.notifications-btn').css('opacity', 1);
|
||||
$('#no_notifications').hide();
|
||||
$('#notifications_wrapper').show();
|
||||
|
@ -635,11 +635,11 @@ function handleNotifications(data) {
|
|||
|
||||
}
|
||||
|
||||
if(data.home || data.intros || data.register || data.mail || data.notify || data.files) {
|
||||
if(data.home || data.intros || data.register || data.mail || data.notify || data.files || data.moderate) {
|
||||
$('.notifications-btn-icon').removeClass('fa-exclamation-circle');
|
||||
$('.notifications-btn-icon').addClass('fa-exclamation-triangle');
|
||||
}
|
||||
if(!data.home && !data.intros && !data.register && !data.mail && !data.notify && !data.files) {
|
||||
if(!data.home && !data.intros && !data.register && !data.mail && !data.notify && !data.files && !data.moderate) {
|
||||
$('.notifications-btn-icon').removeClass('fa-exclamation-triangle');
|
||||
$('.notifications-btn-icon').addClass('fa-exclamation-circle');
|
||||
}
|
||||
|
|
|
@ -182,6 +182,14 @@ let postSaveTimer = null;
|
|||
$(".jothidden").show();
|
||||
$("#profile-jot-text").addClass('jot-expanded');
|
||||
$("#profile-jot-summary").addClass('jot-expanded');
|
||||
|
||||
// let bodytextarea = document.querySelector('#profile-jot-text');
|
||||
// if (typeof bodytextarea != "undefined") {
|
||||
// bodytextarea.addEventListener('input', function handlechange(event) {
|
||||
// imagewatcher(event)
|
||||
// });
|
||||
// }
|
||||
|
||||
{{if $bbco_autocomplete}}
|
||||
$("#profile-jot-text").bbco_autocomplete('{{$bbco_autocomplete}}'); // autocomplete bbcode
|
||||
$("#profile-jot-summary").bbco_autocomplete('{{$bbco_autocomplete}}'); // autocomplete bbcode
|
||||
|
@ -208,6 +216,9 @@ let postSaveTimer = null;
|
|||
}
|
||||
}
|
||||
|
||||
function imagewatcher(event) {
|
||||
console.log(event.target.value);
|
||||
}
|
||||
function enableOnUser(){
|
||||
if(editor)
|
||||
return;
|
||||
|
|
|
@ -172,6 +172,7 @@
|
|||
{{/if}}
|
||||
{{include file="field_intcheckbox.tpl" field=$vnotify14}}
|
||||
{{include file="field_intcheckbox.tpl" field=$vnotify15}}
|
||||
{{include file="field_intcheckbox.tpl" field=$vnotify17}}
|
||||
{{if $vnotify16}}
|
||||
{{include file="field_intcheckbox.tpl" field=$vnotify16}}
|
||||
{{/if}}
|
||||
|
|
Loading…
Reference in a new issue