diff options
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Item.php | 38 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Privacy.php | 7 |
2 files changed, 43 insertions, 2 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']); + } + } + } + } + } + + } diff --git a/Zotlabs/Module/Settings/Privacy.php b/Zotlabs/Module/Settings/Privacy.php index 847bb3b8f..65d5b538e 100644 --- a/Zotlabs/Module/Settings/Privacy.php +++ b/Zotlabs/Module/Settings/Privacy.php @@ -22,6 +22,9 @@ class Privacy { $autoperms = (((x($_POST, 'autoperms')) && (intval($_POST['autoperms']) == 1)) ? 1 : 0); set_pconfig(local_channel(), 'system', 'autoperms', $autoperms); + $permit_all_mentions = (((x($_POST, 'permit_all_mentions')) && (intval($_POST['permit_all_mentions']) == 1)) ? 1 : 0); + set_pconfig(local_channel(), 'system', 'permit_all_mentions', $permit_all_mentions); + $role = get_pconfig(local_channel(), 'system', 'permissions_role'); if ($role === 'custom') { @@ -99,6 +102,7 @@ class Privacy { $autoperms = get_pconfig(local_channel(), 'system', 'autoperms'); $index_opt_out = get_pconfig(local_channel(), 'system', 'index_opt_out'); $group_actor = get_pconfig(local_channel(), 'system', 'group_actor'); + $permit_all_mentions = get_pconfig(local_channel(), 'system', 'permit_all_mentions'); $permissions_role = get_pconfig(local_channel(), 'system', 'permissions_role', 'custom'); $permission_limits = ($permissions_role === 'custom'); @@ -119,7 +123,8 @@ class Privacy { ], '$autoperms' => ['autoperms', t('Automatically approve new contacts'), $autoperms, '', [t('No'), t('Yes')]], '$index_opt_out' => ['index_opt_out', t('Opt-out of search engine indexing'), $index_opt_out, '', [t('No'), t('Yes')]], - '$group_actor' => ['group_actor', t('Group actor'), $group_actor, t('Allow this channel to act as a forum'), [t('No'), t('Yes')]] + '$group_actor' => ['group_actor', t('Group actor'), $group_actor, t('Allow this channel to act as a forum'), [t('No'), t('Yes')]], + '$permit_all_mentions' => ['permit_all_mentions', t('Accept all messages which mention you'), $permit_all_mentions, t('This setting bypasses normal permissions'), [t('No'), t('Yes')]], ]); return $o; |