aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-10-10 18:05:26 +0000
committerMario <mario@mariovavti.com>2022-10-10 18:05:26 +0000
commitef2448e17e742e7dcef458993bce1e0a29756aa7 (patch)
treed23c62753abbb42e7bb742f2d44d09321b6f2eee /Zotlabs/Widget
parent6ab65519a0fc3e55ad5f32ce1641190ef609a4e2 (diff)
parent99a5cf1ad4660a31af6c03e5a1abc3d374f82c78 (diff)
downloadvolse-hubzilla-ef2448e17e742e7dcef458993bce1e0a29756aa7.tar.gz
volse-hubzilla-ef2448e17e742e7dcef458993bce1e0a29756aa7.tar.bz2
volse-hubzilla-ef2448e17e742e7dcef458993bce1e0a29756aa7.zip
Merge branch '7.8RC'7.8
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r--Zotlabs/Widget/Channel_activities.php5
-rw-r--r--Zotlabs/Widget/Cover_photo.php5
-rw-r--r--Zotlabs/Widget/Messages.php30
-rw-r--r--Zotlabs/Widget/Notifications.php1
4 files changed, 27 insertions, 14 deletions
diff --git a/Zotlabs/Widget/Channel_activities.php b/Zotlabs/Widget/Channel_activities.php
index ab1db09ba..9acde591d 100644
--- a/Zotlabs/Widget/Channel_activities.php
+++ b/Zotlabs/Widget/Channel_activities.php
@@ -25,7 +25,7 @@ class Channel_activities {
self::$uid = local_channel();
self::$channel = App::get_channel();
- $o .= '<div id="channel-activities" class="d-none overflow-hidden">';
+ $o = '<div id="channel-activities" class="d-none overflow-hidden">';
$o .= '<h2 class="mb-4">Welcome ' . self::$channel['channel_name'] . '!</h2>';
//$o .= 'Last login date: ' . get_pconfig(self::$uid, 'system', 'stored_login_date') . ' from ' . get_pconfig(self::$uid, 'system', 'stored_login_addr');
@@ -44,6 +44,7 @@ class Channel_activities {
if (!$hookdata['activities']) {
$o .= '<h3>No recent activity to display</h3>';
+ $o .= '</div>';
return $o;
}
@@ -51,8 +52,6 @@ class Channel_activities {
array_multisort($keys, SORT_DESC, $hookdata['activities']);
- // hz_syslog('activities: ' . print_r($hookdata['activities'], true));
-
foreach($hookdata['activities'] as $a) {
$o .= replace_macros(get_markup_template($a['tpl']), [
'$url' => $a['url'],
diff --git a/Zotlabs/Widget/Cover_photo.php b/Zotlabs/Widget/Cover_photo.php
index 11d9c4715..8d42becb5 100644
--- a/Zotlabs/Widget/Cover_photo.php
+++ b/Zotlabs/Widget/Cover_photo.php
@@ -34,7 +34,10 @@ class Cover_photo {
if(! array_key_exists('channels_visited',$_SESSION)) {
$_SESSION['channels_visited'] = [];
}
- $_SESSION['channels_visited'][] = $channel_id;
+
+ if (!in_array($channel_id, $_SESSION['channels_visited'])) {
+ $_SESSION['channels_visited'][] = $channel_id;
+ }
$channel = channelx_by_n($channel_id);
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index 3d9ed8955..c92b9e311 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -45,11 +45,14 @@ class Messages {
if (!local_channel())
return;
- if (isset($options['offset']) && $options['offset'] == -1) {
+ $offset = $options['offset'] ?? 0;
+ $type = $options['type'] ?? 'default';
+
+ if ($offset == -1) {
return;
}
- if (isset($options['type']) && $options['type'] == 'notification') {
+ if ($type == 'notification') {
return self::get_notices_page($options);
}
@@ -58,15 +61,9 @@ class Messages {
$entries = [];
$limit = 30;
$dummy_order_sql = '';
-
- $offset = 0;
- if ($options['offset']) {
- $offset = intval($options['offset']);
- }
-
$loadtime = (($offset) ? $_SESSION['messages_loadtime'] : datetime_convert());
- switch($options['type']) {
+ switch($type) {
case 'direct':
$type_sql = ' AND item_private = 2 ';
// $dummy_order_sql has no other meaning but to trick
@@ -98,8 +95,21 @@ class Messages {
foreach($items as $item) {
+ $hook_data = [
+ 'uid' => $item['uid'],
+ 'owner_xchan' => $item['owner_xchan'],
+ 'author_xchan' => $item['author_xchan'],
+ 'cancel' => false
+ ];
+
+ call_hooks('messages_widget', $hook_data);
+
+ if ($hook_data['cancel']) {
+ continue;
+ }
+
$info = '';
- if ($options['type'] == 'direct') {
+ if ($type == 'direct') {
$info .= self::get_dm_recipients($channel, $item);
}
diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php
index 0e02d5cc1..a4e632a9f 100644
--- a/Zotlabs/Widget/Notifications.php
+++ b/Zotlabs/Widget/Notifications.php
@@ -13,6 +13,7 @@ class Notifications {
function widget($arr) {
$channel = \App::get_channel();
+ $notifications = [];
if(local_channel()) {
$notifications[] = [