diff options
author | Mario <mario@mariovavti.com> | 2023-03-23 20:11:18 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-03-23 20:11:18 +0000 |
commit | 2c483c460a2d5c806b9e62097673ad237e6b154a (patch) | |
tree | 811998820caebf68be26eb471c6f218ec2039992 /Zotlabs/Module/Item.php | |
parent | 5c755fdd1c41538c243a428bb72aa2bd62ff105f (diff) | |
download | volse-hubzilla-2c483c460a2d5c806b9e62097673ad237e6b154a.tar.gz volse-hubzilla-2c483c460a2d5c806b9e62097673ad237e6b154a.tar.bz2 volse-hubzilla-2c483c460a2d5c806b9e62097673ad237e6b154a.zip |
initial check in to allow all mentions option
Diffstat (limited to 'Zotlabs/Module/Item.php')
-rw-r--r-- | Zotlabs/Module/Item.php | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 5ca94cd76..b3b040e96 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -1194,12 +1194,15 @@ class Item extends Controller { (($remote_id) ? $remote_id : basename($datarray['mid'])), true); } - if ($orig_post) { $datarray['id'] = $post_id; $x = item_store_update($datarray, $execflag); + if ($x['success']) { + $this->add_listeners($datarray); + } + // We only need edit activities for other federated protocols // which do not support edits natively. While this does federate // edits, it presents a number of issues locally - such as #757 and #758. @@ -1238,6 +1241,10 @@ class Item extends Controller { $post = item_store($datarray, $execflag); + if ($post['success']) { + $this->add_listeners($datarray); + } + $post_id = $post['item_id']; $datarray = $post['item']; @@ -1603,4 +1610,33 @@ class Item extends Controller { } + function add_listeners($item) { + // ONLY public items! + if ($item['item_thread_top'] && !$item['item_private'] && !empty($item['term'])) { + foreach($item['term'] as $t) { + if (empty($t['url']) || $t['ttype'] != TERM_MENTION || $t['otype'] != TERM_OBJ_POST) { + continue; + } + + $listener = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s' and hubloc_deleted = 0 order by hubloc_id desc", + dbesc($t['url']) + ); + + if ($listener) { + $listener = Libzot::zot_record_preferred($listener); + + $c = q("select abook_id from abook where abook_channel = %d and abook_xchan = '%s'", + intval($profile_uid), + dbesc($listener['hubloc_hash']) + ); + + if (!$c) { + ThreadListener::store($item['mid'], $listener['hubloc_hash']); + } + } + } + } + } + + } |