mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 05:15:16 +00:00
Merge branch 'dev' of ../p3 into dev
This commit is contained in:
commit
bd6a4ec0e4
2 changed files with 43 additions and 17 deletions
|
@ -2752,6 +2752,12 @@ class Activity {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Do not proceed further if there is no actor.
|
||||
|
||||
if (! isset($act->actor['id'])) {
|
||||
logger('No actor!');
|
||||
return false;
|
||||
}
|
||||
|
||||
$s['owner_xchan'] = $act->actor['id'];
|
||||
$s['author_xchan'] = $act->actor['id'];
|
||||
|
@ -2845,7 +2851,7 @@ class Activity {
|
|||
}
|
||||
|
||||
|
||||
// ensure we store the original actor
|
||||
// ensure we store the original actor of the associated (parent) object
|
||||
self::actor_store($obj_actor['id'],$obj_actor);
|
||||
|
||||
$mention = self::get_actor_bbmention($obj_actor['id']);
|
||||
|
@ -3026,7 +3032,7 @@ class Activity {
|
|||
// Objects that might have media attachments which aren't already provided in the content element.
|
||||
// We'll check specific media objects separately.
|
||||
|
||||
if (in_array($act->obj['type'], [ 'Article', 'Document', 'Event', 'Note', 'Page', 'Place', 'Question']) && isset($s['attach']) && $s['attach']) {
|
||||
if (in_array($act->obj['type'], [ 'Article', 'Document', 'Event', 'Note', 'Page', 'Place', 'Question' ]) && isset($s['attach']) && $s['attach']) {
|
||||
$s['body'] .= self::bb_attach($s['attach'],$s['body']);
|
||||
}
|
||||
|
||||
|
@ -3281,6 +3287,7 @@ class Activity {
|
|||
$s['item_private'] = 2;
|
||||
}
|
||||
|
||||
|
||||
set_iconfig($s,'activitypub','rawmsg',$act->raw,1);
|
||||
|
||||
// Restrict html caching to ActivityPub senders.
|
||||
|
@ -3458,6 +3465,7 @@ class Activity {
|
|||
}
|
||||
|
||||
|
||||
|
||||
if ($item['parent_mid'] && $item['parent_mid'] !== $item['mid']) {
|
||||
$is_child_node = true;
|
||||
}
|
||||
|
@ -3674,17 +3682,6 @@ class Activity {
|
|||
|
||||
set_iconfig($item,'activitypub','recips',$act->raw_recips);
|
||||
|
||||
if (! (isset($act->data['inheritPrivacy']) && $act->data['inheritPrivacy'])) {
|
||||
if ($item['item_private']) {
|
||||
$item['item_restrict'] = $item['item_restrict'] & 1;
|
||||
if ($is_child_node) {
|
||||
$item['allow_cid'] = '<' . $channel['channel_hash'] . '>';
|
||||
$item['allow_gid'] = $item['deny_cid'] = $item['deny_gid'] = '';
|
||||
}
|
||||
logger('restricted');
|
||||
}
|
||||
}
|
||||
|
||||
if (intval($act->sigok)) {
|
||||
$item['item_verified'] = 1;
|
||||
}
|
||||
|
@ -3730,6 +3727,32 @@ class Activity {
|
|||
$item['thr_parent'] = $parent[0]['parent_mid'];
|
||||
}
|
||||
$item['parent_mid'] = $parent[0]['parent_mid'];
|
||||
|
||||
/*
|
||||
*
|
||||
* Check for conversation privacy mismatches
|
||||
* We can only do this if we have a channel and we have fetched the parent
|
||||
*
|
||||
*/
|
||||
|
||||
// public conversation, but this comment went rogue and was published privately
|
||||
// hide it from everybody except the channel owner
|
||||
|
||||
if (intval($parent[0]['item_private']) === 0) {
|
||||
if (intval($item['item_private'])) {
|
||||
$item['item_restrict'] = $item['item_restrict'] | 1;
|
||||
$item['allow_cid'] = '<' . $channel['channel_hash'] . '>';
|
||||
$item['allow_gid'] = $item['deny_cid'] = $item['deny_gid'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Private conversation, but this comment went rogue and was published publicly
|
||||
// Set item_restrict to indicate this condition so we can flag it in the UI
|
||||
|
||||
if (intval($parent[0]['item_private']) !== 0 && $act->recips && (in_array(ACTIVITY_PUBLIC_INBOX,$act->recips) || in_array('Public',$act->recips) || in_array('as:Public',$act->recips))) {
|
||||
$item['item_restrict'] = $item['item_restrict'] | 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
self::rewrite_mentions($item);
|
||||
|
@ -4236,7 +4259,6 @@ class Activity {
|
|||
|
||||
return [
|
||||
'zot' => z_root() . '/apschema#',
|
||||
// 'as' => 'https://www.w3.org/ns/activitystreams#',
|
||||
'toot' => 'http://joinmastodon.org/ns#',
|
||||
'ostatus' => 'http://ostatus.org#',
|
||||
'schema' => 'http://schema.org#',
|
||||
|
@ -4249,7 +4271,6 @@ class Activity {
|
|||
'movedTo' => 'as:movedTo',
|
||||
'copiedTo' => 'as:copiedTo',
|
||||
'alsoKnownAs' => 'as:alsoKnownAs',
|
||||
'inheritPrivacy' => 'as:inheritPrivacy',
|
||||
'EmojiReact' => 'as:EmojiReact',
|
||||
'commentPolicy' => 'zot:commentPolicy',
|
||||
'topicalCollection' => 'zot:topicalCollection',
|
||||
|
|
|
@ -104,6 +104,7 @@ class ThreadItem {
|
|||
$osparkle = '';
|
||||
$total_children = $this->count_descendants();
|
||||
$unseen_comments = ((isset($item['real_uid']) && $item['real_uid']) ? 0 : $this->count_unseen_descendants());
|
||||
$privacy_warning = false;
|
||||
|
||||
$conv = $this->get_conversation();
|
||||
$observer = $conv->get_observer();
|
||||
|
@ -115,13 +116,17 @@ class ThreadItem {
|
|||
|
||||
$locktype = $item['item_private'];
|
||||
|
||||
$shareable = ((($conv->get_profile_owner() == local_channel() && local_channel()) && ($item['item_private'] != 1)) ? true : false);
|
||||
$shareable = ((($conv->get_profile_owner() == local_channel() && local_channel()) && (! intval($item['item_private']))) ? true : false);
|
||||
|
||||
// allow an exemption for sharing stuff from your private feeds
|
||||
if($item['author']['xchan_network'] === 'rss')
|
||||
$shareable = true;
|
||||
|
||||
$privacy_warning = false;
|
||||
|
||||
if ($item['item_restrict'] & 2) {
|
||||
$privacy_warning = true;
|
||||
$lock = t('This comment is part of a private conversation, yet was shared with the public. Discretion advised.');
|
||||
}
|
||||
|
||||
$mode = $conv->get_mode();
|
||||
|
||||
|
|
Loading…
Reference in a new issue