aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/Enotify.php6
-rw-r--r--Zotlabs/Module/Hq.php1
-rw-r--r--Zotlabs/Widget/Messages.php53
-rw-r--r--view/tpl/messages_widget.tpl5
4 files changed, 60 insertions, 5 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 632848290..d02dab739 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -127,7 +127,7 @@ class Enotify {
logger('notification: mail');
$subject = sprintf( t('[$Projectname:Notify] New direct message received at %s'), $sitename);
- $preamble = sprintf( t('%1$s sent you a new direct message at %2$s.'), $sender['xchan_name'], $sitename);
+ $preamble = sprintf( t('%1$s sent you a new direct message at %2$s'), $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s sent you %2$s.'), '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=$itemlink]' . t('a direct message') . '[/zrl]');
$sitelink = t('Please visit %s to view and/or reply to your direct messages.');
$tsitelink = sprintf( $sitelink, $siteurl . '/hq/' . gen_link_id($params['item']['mid']));
@@ -238,7 +238,7 @@ class Enotify {
$subject = sprintf( t('[$Projectname:Notify] Moderated Comment to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']);
else
$subject = sprintf( t('[$Projectname:Notify] Comment to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']);
- $preamble = sprintf( t('%1$s commented on an item/conversation you have been following.'), $sender['xchan_name']);
+ $preamble = sprintf( t('%1$s commented on an item/conversation you have been following'), $sender['xchan_name']);
$epreamble = $dest_str;
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
@@ -318,7 +318,7 @@ class Enotify {
// differents subjects for messages on the same thread.
$subject = sprintf( t('[$Projectname:Notify] Like received to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']);
- $preamble = sprintf( t('%1$s liked an item/conversation you created.'), $sender['xchan_name']);
+ $preamble = sprintf( t('%1$s liked an item/conversation you created'), $sender['xchan_name']);
$epreamble = $dest_str;
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index 929f2b758..3b8e88488 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -254,7 +254,6 @@ class Hq extends \Zotlabs\Web\Controller {
return;
$options['offset'] = $_REQUEST['offset'];
- $options['dm'] = $_REQUEST['dm'];
$options['type'] = $_REQUEST['type'];
$ret = Messages::get_messages_page($options);
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index 21375b08f..99de57704 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -11,7 +11,7 @@ class Messages {
if (!local_channel())
return EMPTY_STR;
- $page = self::get_messages_page($options);
+ $page = self::get_messages_page([]);
$_SESSION['messages_loadtime'] = datetime_convert();
@@ -24,6 +24,7 @@ class Messages {
'messages_title' => t('Public and restricted messages'),
'direct_messages_title' => t('Direct messages'),
'starred_messages_title' => t('Starred messages'),
+ 'notice_messages_title' => t('Notices'),
'loading' => t('Loading'),
'empty' => t('No messages')
]
@@ -40,6 +41,10 @@ class Messages {
return;
}
+ if ($options['type'] == 'notification') {
+ return self::get_notices_page($options);
+ }
+
$channel = App::get_channel();
$item_normal = item_normal();
$entries = [];
@@ -181,4 +186,50 @@ class Messages {
return trim($recipients, ', ');
}
+ public static function get_notices_page($options) {
+
+ if (!local_channel())
+ return;
+
+ $limit = 30;
+
+ $offset = 0;
+ if ($options['offset']) {
+ $offset = intval($options['offset']);
+ }
+
+ $notices = q("SELECT * FROM notify WHERE uid = %d
+ ORDER BY created DESC LIMIT $limit OFFSET $offset",
+ intval(local_channel())
+ );
+
+ $i = 0;
+
+ foreach($notices as $notice) {
+
+ $summary = trim(strip_tags(bbcode($notice['msg'])));
+
+ if(strpos($summary, $notification['xname']) === 0) {
+ $summary = substr($summary, strlen($notice['xname']) + 1);
+ }
+
+ $entries[$i]['author_name'] = $notice['xname'];
+ $entries[$i]['author_addr'] = $notice['url'];
+ $entries[$i]['info'] = '';
+ $entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $notice['created']);
+ $entries[$i]['summary'] = $summary;
+ $entries[$i]['b64mid'] = basename($notice['link']);
+ $entries[$i]['href'] = z_root() . '/hq/' . basename($notice['link']);
+ $entries[$i]['icon'] = '';
+
+ $i++;
+ }
+
+ $result = [
+ 'offset' => ((count($entries) < $limit) ? -1 : intval($offset + $limit)),
+ 'entries' => $entries
+ ];
+
+ return $result;
+ }
}
diff --git a/view/tpl/messages_widget.tpl b/view/tpl/messages_widget.tpl
index 2d7ab99df..65afaf7ae 100644
--- a/view/tpl/messages_widget.tpl
+++ b/view/tpl/messages_widget.tpl
@@ -16,6 +16,11 @@
</a>
</li>
{{/if}}
+ <li class="nav-item">
+ <a class="nav-link messages-type" href="#" title="{{$strings.notice_messages_title}}" data-messages_type="notification">
+ <i class="fa fa-fw fa-exclamation-circle"></i>
+ </a>
+ </li>
</ul>
<div id="messages-widget" class="border border-top-0 overflow-auto mb-3 clearfix" style="height: 70vh;">
<div id="messages-template" rel="template" class="d-none">