[PLUGIN][ActivityPub][Notification] Fix some issues with targetting

This commit is contained in:
2022-03-23 13:18:44 +00:00
parent e63c310d70
commit 56b8710b26
5 changed files with 23 additions and 13 deletions

View File

@@ -75,7 +75,7 @@ class Repeat extends Controller
if ($form_add_to_repeat->isSubmitted()) {
$repeat_activity = \Plugin\RepeatNote\RepeatNote::repeatNote(note: $note, actor_id: $actor_id);
DB::flush();
Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $repeat_activity, [], _m('{actor_id} repeated note {note_id}.', ['{actor_id}' => $actor->getId(), '{note_id}' => $repeat_activity->getObjectId()])]);
Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $repeat_activity, $repeat_activity->getAttentionTargets(), _m('{actor_id} repeated note {note_id}.', ['{actor_id}' => $actor->getId(), '{note_id}' => $repeat_activity->getObjectId()])]);
// Redirect user to where they came from
// Prevent open redirect
@@ -132,7 +132,7 @@ class Repeat extends Controller
if ($form_remove_repeat->isSubmitted()) {
if (!\is_null($undo_repeat_activity = \Plugin\RepeatNote\RepeatNote::unrepeatNote(note_id: $note_id, actor_id: $actor_id))) {
DB::flush();
Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $undo_repeat_activity, [], _m('{actor_id} unrepeated note {note_id}.', ['{actor_id}' => $actor->getId(), '{note_id}' => $note_id])]);
Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $undo_repeat_activity, $undo_repeat_activity->getAttentionTargets(), _m('{actor_id} unrepeated note {note_id}.', ['{actor_id}' => $actor->getId(), '{note_id}' => $note_id])]);
} else {
throw new ClientException(_m('Note wasn\'t repeated!'));
}