[PLUGIN][Favourite] Notify when actor favours a note

This commit is contained in:
Diogo Peralta Cordeiro 2021-12-10 04:02:27 +00:00
parent 60d31e097e
commit 0ee4cc7709
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
1 changed files with 7 additions and 4 deletions

View File

@ -58,6 +58,8 @@ class Favourite extends NoteHandlerPlugin
'source' => $source,
]);
DB::persist($act);
Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $act, [], "{$actor->getNickname()} favoured note {$note_id}"]);
}
return $act ?? null;
}
@ -76,6 +78,8 @@ class Favourite extends NoteHandlerPlugin
'source' => $source,
]);
DB::persist($act);
Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $act, [], "{$actor->getNickname()} unfavoured note {$note_id}"]);
}
return $act ?? null;
}
@ -84,11 +88,10 @@ class Favourite extends NoteHandlerPlugin
* HTML rendering event that adds the favourite form as a note
* action, if a user is logged in
*
* @param Request $request
* @param Note $note
* @param array $actions
* @return bool Event hook
* @throws NoSuchNoteException
* @throws RedirectException
*
* @throws InvalidFormException
*/
public function onAddNoteActions(Request $request, Note $note, array &$actions): bool
{