Issue 14377: Support for "postingRestrictedToMods" added

This commit is contained in:
Michael 2024-08-20 05:58:24 +00:00
parent 355273b13c
commit d9d9cd45e4
8 changed files with 56 additions and 37 deletions

View file

@ -295,6 +295,10 @@ class APContact
return $fetched_contact;
}
if (!empty($compacted['https://webfinger.net/#'])) {
$apcontact['addr'] = JsonLD::fetchElement($compacted, 'https://webfinger.net/#');
}
if (empty($apcontact['addr']) && ($apcontact['type'] != 'Tombstone')) {
try {
$apcontact['addr'] = $apcontact['nick'] . '@' . (new Uri($apcontact['url']))->getAuthority();
@ -313,7 +317,7 @@ class APContact
}
$apcontact['manually-approve'] = (int)JsonLD::fetchElement($compacted, 'as:manuallyApprovesFollowers');
$apcontact['posting-restricted'] = (int)JsonLD::fetchElement($compacted, 'lemmy:postingRestrictedToMods');
$apcontact['suspended'] = (int)JsonLD::fetchElement($compacted, 'toot:suspended');
if (!empty($compacted['as:generator'])) {

View file

@ -993,6 +993,11 @@ class Processor
}
}
$author = Contact::selectFirstAccount(['ap-posting-restricted'], ['id' => $item['author-id']]);
if (!empty($author['ap-posting-restricted'])) {
$item['restrictions'] = $item['restrictions'] | Item::CANT_REPLY;
}
$item['location'] = $activity['location'];
if (!empty($activity['latitude']) && !empty($activity['longitude'])) {

View file

@ -605,6 +605,8 @@ class Receiver
* @param boolean $trust_source Do we trust the source?
* @param boolean $push Message had been pushed to our system
* @param array $signer The signer of the post
* @param string $http_signer
* @param int $completion
*
* @return bool
*

View file

@ -176,6 +176,7 @@ class JsonLD
'fedibird' => (object)['@id' => 'http://fedibird.com/ns#', '@type' => '@id'],
'misskey' => (object)['@id' => 'https://misskey-hub.net/ns#', '@type' => '@id'],
'pixelfed' => (object)['@id' => 'http://pixelfed.org/ns#', '@type' => '@id'],
'lemmy' => (object)['@id' => 'https://join-lemmy.org/ns#', '@type' => '@id'],
];
$orig_json = $json;