diff --git a/Code/Module/Ping.php b/Code/Module/Ping.php index 2c78d9d7e..fa5899269 100644 --- a/Code/Module/Ping.php +++ b/Code/Module/Ping.php @@ -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( diff --git a/Code/Module/Settings/Channel.php b/Code/Module/Settings/Channel.php index f672de82e..213ed7ac1 100644 --- a/Code/Module/Settings/Channel.php +++ b/Code/Module/Settings/Channel.php @@ -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())], diff --git a/Code/Widget/Notifications.php b/Code/Widget/Notifications.php index 9a26640b4..34a007ad8 100644 --- a/Code/Widget/Notifications.php +++ b/Code/Widget/Notifications.php @@ -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', diff --git a/view/js/main.js b/view/js/main.js index dc1bfe08e..0477c5c91 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -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'); } diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index 4c90871ed..0e81f6643 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -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; diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl index 11aaf1a60..70755951d 100755 --- a/view/tpl/settings.tpl +++ b/view/tpl/settings.tpl @@ -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}}