From 81ecea29c839c8f914be59acbddd4955673ee2f6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 22 Jul 2019 19:11:52 +0200 Subject: reflect repeats in notifications, use force flag for import_xchan_photo() in cron --- Zotlabs/Daemon/Cron.php | 2 +- Zotlabs/Lib/Enotify.php | 17 ++++++++++++----- Zotlabs/Module/Share.php | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index c99892ffb..fe356bcbf 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -188,7 +188,7 @@ class Cron { if($r) { require_once('include/photo/photo_driver.php'); foreach($r as $rr) { - $photos = import_xchan_photo($rr['xchan_photo_l'],$rr['xchan_hash']); + $photos = import_xchan_photo($rr['xchan_photo_l'], $rr['xchan_hash'], false, true); $x = q("update xchan set xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'", dbesc($photos[0]), diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index a7082f45a..92a488f67 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -807,6 +807,11 @@ class Enotify { $itemem_text = (($item['item_thread_top']) ? t('created a new post') : sprintf( t('commented on %s\'s post'), $item['owner']['xchan_name'])); + + if($item['verb'] === ACTIVITY_SHARE) { + $itemem_text = sprintf( t('repeated %s\'s post'), $item['author']['xchan_name']); + } + } $edit = false; @@ -825,12 +830,14 @@ class Enotify { // convert this logic into a json array just like the system notifications + $who = (($item['verb'] === ACTIVITY_SHARE) ? 'owner' : 'author'); + $x = array( 'notify_link' => $item['llink'], - 'name' => $item['author']['xchan_name'], - 'addr' => (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']), - 'url' => $item['author']['xchan_url'], - 'photo' => $item['author']['xchan_photo_s'], + 'name' => $item[$who]['xchan_name'], + 'addr' => (($item[$who]['xchan_addr']) ? $item[$who]['xchan_addr'] : $item[$who]['xchan_url']), + 'url' => $item[$who]['xchan_url'], + 'photo' => $item[$who]['xchan_photo_s'], 'when' => relative_date(($edit)? $item['edited'] : $item['created']), 'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'), 'b64mid' => ((in_array($item['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) ? 'b64.' . base64url_encode($item['thr_parent']) : 'b64.' . base64url_encode($item['mid'])), @@ -838,7 +845,7 @@ class Enotify { 'thread_top' => (($item['item_thread_top']) ? true : false), 'message' => strip_tags(bbcode($itemem_text)), // these are for the superblock addon - 'hash' => $item['author']['xchan_hash'], + 'hash' => $item[$who]['xchan_hash'], 'uid' => local_channel(), 'display' => true ); diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php index 53a06b072..a18a81937 100644 --- a/Zotlabs/Module/Share.php +++ b/Zotlabs/Module/Share.php @@ -106,7 +106,7 @@ class Share extends \Zotlabs\Web\Controller { $arr['owner_xchan'] = $item['author_xchan']; $arr['obj'] = Activity::encode_item($item); $arr['obj_type'] = $item['obj_type']; - $arr['verb'] = 'Announce'; + $arr['verb'] = ACTIVITY_SHARE; $post = item_store($arr); -- cgit v1.2.3