Private posts with Mastodon don't work - but this is expected

pull/5794/head
Michael 2018-09-18 19:36:27 +00:00
rodzic 464650d4d7
commit cb073bea61
1 zmienionych plików z 15 dodań i 29 usunięć

Wyświetl plik

@ -125,9 +125,8 @@ class ActivityPub
} }
$data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1', $data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1',
['uuid' => 'http://schema.org/identifier', 'sensitive' => 'as:sensitive', ['vcard' => 'http://www.w3.org/2006/vcard/ns#', 'uuid' => 'http://schema.org/identifier',
'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers', 'sensitive' => 'as:sensitive', 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers']]];
'vcard' => 'http://www.w3.org/2006/vcard/ns#']]];
$data['id'] = $contact['url']; $data['id'] = $contact['url'];
$data['uuid'] = $user['guid']; $data['uuid'] = $user['guid'];
@ -174,7 +173,7 @@ class ActivityPub
} }
} }
} else { } else {
$data['to'][] = System::baseUrl() . '/followers/' . $item['author-nick']; //$data['cc'][] = System::baseUrl() . '/followers/' . $item['author-nick'];
$receiver_list = Item::enumeratePermissions($item); $receiver_list = Item::enumeratePermissions($item);
$mentioned = []; $mentioned = [];
@ -197,7 +196,7 @@ class ActivityPub
if (empty($data['to'])) { if (empty($data['to'])) {
$data['to'] = $data['cc']; $data['to'] = $data['cc'];
unset($data['cc']); $data['cc'] = [];
} }
} }
@ -242,8 +241,7 @@ class ActivityPub
$contact = DBA::selectFirst('contact', ['url'], ['id' => $cid, 'network' => Protocol::ACTIVITYPUB]); $contact = DBA::selectFirst('contact', ['url'], ['id' => $cid, 'network' => Protocol::ACTIVITYPUB]);
$profile = Probe::uri($contact['url'], Protocol::ACTIVITYPUB); $profile = Probe::uri($contact['url'], Protocol::ACTIVITYPUB);
if ($profile['network'] == Protocol::ACTIVITYPUB) { if ($profile['network'] == Protocol::ACTIVITYPUB) {
//$target = defaults($profile, 'batch', $profile['notify']); $target = defaults($profile, 'batch', $profile['notify']);
$target = $profile['notify'];
$inboxes[$target] = $target; $inboxes[$target] = $target;
} }
} }
@ -253,8 +251,7 @@ class ActivityPub
$contact = DBA::selectFirst('contact', ['url'], ['id' => $receiver, 'network' => Protocol::ACTIVITYPUB]); $contact = DBA::selectFirst('contact', ['url'], ['id' => $receiver, 'network' => Protocol::ACTIVITYPUB]);
$profile = Probe::uri($contact['url'], Protocol::ACTIVITYPUB); $profile = Probe::uri($contact['url'], Protocol::ACTIVITYPUB);
if ($profile['network'] == Protocol::ACTIVITYPUB) { if ($profile['network'] == Protocol::ACTIVITYPUB) {
//$target = defaults($profile, 'batch', $profile['notify']); $target = defaults($profile, 'batch', $profile['notify']);
$target = $profile['notify'];
$inboxes[$target] = $target; $inboxes[$target] = $target;
} }
} }
@ -290,10 +287,10 @@ class ActivityPub
} }
$data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1', $data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1',
['Emoji' => 'toot:Emoji', 'Hashtag' => 'as:Hashtag', 'atomUri' => 'ostatus:atomUri', ['ostatus' => 'http://ostatus.org#', 'sensitive' => 'as:sensitive',
'conversation' => 'ostatus:conversation', 'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri', 'Hashtag' => 'as:Hashtag', 'atomUri' => 'ostatus:atomUri',
'ostatus' => 'http://ostatus.org#', 'sensitive' => 'as:sensitive', 'conversation' => 'ostatus:conversation',
'toot' => 'http://joinmastodon.org/ns#']]]; 'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri']]];
$data['type'] = 'Create'; $data['type'] = 'Create';
$data['id'] = $item['uri'] . '#activity'; $data['id'] = $item['uri'] . '#activity';
@ -320,10 +317,10 @@ class ActivityPub
} }
$data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1', $data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1',
['Emoji' => 'toot:Emoji', 'Hashtag' => 'as:Hashtag', 'atomUri' => 'ostatus:atomUri', ['ostatus' => 'http://ostatus.org#', 'sensitive' => 'as:sensitive',
'conversation' => 'ostatus:conversation', 'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri', 'Hashtag' => 'as:Hashtag', 'atomUri' => 'ostatus:atomUri',
'ostatus' => 'http://ostatus.org#', 'sensitive' => 'as:sensitive', 'conversation' => 'ostatus:conversation',
'toot' => 'http://joinmastodon.org/ns#']]]; 'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri']]];
$data = array_merge($data, self::createNote($item)); $data = array_merge($data, self::createNote($item));
@ -335,17 +332,6 @@ class ActivityPub
{ {
$tags = []; $tags = [];
$receiver_list = Item::enumeratePermissions($item);
foreach ($receiver_list as $receiver) {
$contact = DBA::selectFirst('contact', ['url', 'addr'], ['id' => $receiver, 'network' => Protocol::ACTIVITYPUB]);
if (!empty($contact['addr'])) {
$mention = '@' . $contact['addr'];
} else {
$mention = '@' . $term['url'];
}
$tags[] = ['type' => 'Mention', 'href' => $contact['url'], 'name' => $mention];
}
$terms = Term::tagArrayFromItemId($item['id']); $terms = Term::tagArrayFromItemId($item['id']);
foreach ($terms as $term) { foreach ($terms as $term) {
if ($term['type'] == TERM_MENTION) { if ($term['type'] == TERM_MENTION) {
@ -395,7 +381,7 @@ class ActivityPub
$data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"]; $data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"];
$data['summary'] = ''; // Ignore by now $data['summary'] = ''; // Ignore by now
$data['sensitive'] = false; // - Query NSFW $data['sensitive'] = false; // - Query NSFW
$data['emoji'] = []; // Ignore by now //$data['emoji'] = []; // Ignore by now
$data['tag'] = self::createTagList($item); $data['tag'] = self::createTagList($item);
$data['attachment'] = []; // @ToDo $data['attachment'] = []; // @ToDo
return $data; return $data;