[PLUGIN][RepeatNote] Add support for onGSVerbToActivityStreamsTwoActivityType

This commit is contained in:
Diogo Peralta Cordeiro 2021-12-12 06:49:14 +00:00
parent 8d1e000574
commit 630e22579e
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0

View File

@ -53,11 +53,11 @@ class RepeatNote extends NoteHandlerPlugin
if (!\is_null($repeat_entity)) { if (!\is_null($repeat_entity)) {
return DB::findBy('activity', [ return DB::findBy('activity', [
'actor_id' => $actor_id, 'actor_id' => $actor_id,
'verb' => 'repeat', 'verb' => 'repeat',
'object_type' => 'note', 'object_type' => 'note',
'object_id' => $note->getId(), 'object_id' => $note->getId()
], order_by: ['created' => 'dsc'])[0]; ], order_by: ['created' => 'DESC'])[0];
} }
// Create a new note with the same content as the original // Create a new note with the same content as the original
@ -337,4 +337,13 @@ class RepeatNote extends NoteHandlerPlugin
{ {
return $this->activitypub_handler($actor, $type_activity, $type_object, $ap_act); return $this->activitypub_handler($actor, $type_activity, $type_object, $ap_act);
} }
public function onGSVerbToActivityStreamsTwoActivityType(string $verb, ?string &$gs_verb_to_activity_stream_two_verb): bool
{
if ($verb === 'repeat') {
$gs_verb_to_activity_stream_two_verb = 'Announce';
return Event::stop;
}
return Event::next;
}
} }