From 92e6c21210b71acb2e1071171fa8cd7e76640f7b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 7 Feb 2019 14:13:13 -0800 Subject: add missing zot6 conversation completion (required for message repeats) --- Zotlabs/Lib/ThreadListener.php | 53 +++++++++++++++ Zotlabs/Module/Item.php | 144 +++++++++++++++++++++++++++++++++++++++++ include/items.php | 19 ++++++ 3 files changed, 216 insertions(+) create mode 100644 Zotlabs/Lib/ThreadListener.php diff --git a/Zotlabs/Lib/ThreadListener.php b/Zotlabs/Lib/ThreadListener.php new file mode 100644 index 000000000..ad682aac8 --- /dev/null +++ b/Zotlabs/Lib/ThreadListener.php @@ -0,0 +1,53 @@ + [ + ACTIVITYSTREAMS_JSONLD_REV, + 'https://w3id.org/security/v1', + z_root() . ZOT_APSCHEMA_REV + ]], $i); + + $headers = []; + $headers['Content-Type'] = 'application/x-zot+json' ; + $x['signature'] = LDSignatures::sign($x,$chan); + $ret = json_encode($x, JSON_UNESCAPED_SLASHES); + $headers['Digest'] = HTTPSig::generate_digest_header($ret); + $headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI']; + $h = HTTPSig::create_sig($headers,$chan['channel_prvkey'],channel_url($chan)); + HTTPSig::set_headers($h); + echo $ret; + killme(); + + } + } + + + function post() { // This will change. Figure out who the observer is and whether or not diff --git a/include/items.php b/include/items.php index 76ae79e6f..a14e3db3a 100755 --- a/include/items.php +++ b/include/items.php @@ -7,6 +7,7 @@ use Zotlabs\Lib\Enotify; use Zotlabs\Lib\MarkdownSoap; use Zotlabs\Lib\MessageFilter; +use Zotlabs\Lib\ThreadListener; use Zotlabs\Lib\IConfig; use Zotlabs\Access\PermissionLimits; use Zotlabs\Access\AccessList; @@ -141,6 +142,22 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) { // $recipients[] = $sys['xchan_hash']; } + + // Forward to thread listeners, *unless* there is even a remote hint that the item + // might have some privacy attached. This could be (for instance) an ActivityPub DM + // in the middle of a public thread. Unless we can guarantee beyond all doubt that + // this is public, don't allow it to go to thread listeners. + + if(! intval($item['item_private'])) { + $r = ThreadListener::fetch_by_target($item['parent_mid']); + if($r) { + foreach($r as $rv) { + $recipients[] = $rv['portable_id']; + } + } + } + + // Add the authors of any posts in this thread, if they are known to us. // This is specifically designed to forward wall-to-wall posts to the original author, // in case they aren't a connection but have permission to write on our wall. @@ -3867,6 +3884,8 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false) { intval(TERM_OBJ_POST) ); + ThreadListener::delete_by_target($item['mid']); + /** @FIXME remove notifications for this item */ return true; -- cgit v1.2.3