From 9cda64f27594a8ad40d10955406bf8a7a6b7fbc7 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Tue, 28 Dec 2021 16:36:52 +0000 Subject: [PATCH] [COMPONENT][Notification] Use _m() in reason --- components/Posting/Posting.php | 2 +- plugins/ActivityPub/Controller/Inbox.php | 2 +- plugins/DeleteNote/DeleteNote.php | 2 +- plugins/Favourite/Favourite.php | 4 ++-- plugins/RepeatNote/RepeatNote.php | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/Posting/Posting.php b/components/Posting/Posting.php index 69aa63bc68..8b1521a400 100644 --- a/components/Posting/Posting.php +++ b/components/Posting/Posting.php @@ -281,7 +281,7 @@ class Posting extends Component } DB::flush(); - Event::handle('NewNotification', [$actor, $activity, ['object' => $mentioned], "{$actor->getNickname()} created note {$note->getUrl()}"]); + Event::handle('NewNotification', [$actor, $activity, ['object' => $mentioned], _m('{nickname} created a note {note_id}.', ['nickname' => $actor->getNickname(), 'note_id' => $activity->getObjectId()])]); return $note; } diff --git a/plugins/ActivityPub/Controller/Inbox.php b/plugins/ActivityPub/Controller/Inbox.php index 5aa91f23e4..1da31c4922 100644 --- a/plugins/ActivityPub/Controller/Inbox.php +++ b/plugins/ActivityPub/Controller/Inbox.php @@ -165,7 +165,7 @@ class Inbox extends Controller $ap_actor->getActorId(), Discovery::normalize($actor->getNickname() . '@' . parse_url($ap_actor->getInboxUri(), PHP_URL_HOST)), ); - Event::handle('NewNotification', [$actor, $ap_act->getActivity(), [], "{$actor->getNickname()} mentioned you in a note"]); + Event::handle('NewNotification', [$actor, $ap_act->getActivity(), [], _m('{nickname} mentioned you.', ['nickname' => $actor->getNickname()])]); DB::flush(); dd($ap_act, $act = $ap_act->getActivity(), $act->getActor(), $act->getObject()); diff --git a/plugins/DeleteNote/DeleteNote.php b/plugins/DeleteNote/DeleteNote.php index 2b78890c7f..26d6cd0b49 100644 --- a/plugins/DeleteNote/DeleteNote.php +++ b/plugins/DeleteNote/DeleteNote.php @@ -60,7 +60,7 @@ class DeleteNote extends NoteHandlerPlugin $activity = $note->delete(actor: $actor, source: 'web'); // Undertaker successful - Event::handle('NewNotification', [$actor, $activity, [], "{$actor->getNickname()} deleted note {$activity->getObjectId()}"]); + Event::handle('NewNotification', [$actor, $activity, [], _m('{nickname} deleted note {note_id}.', ['nickname' => $actor->getNickname(), 'note_id' => $activity->getObjectId()])]); return $activity; } diff --git a/plugins/Favourite/Favourite.php b/plugins/Favourite/Favourite.php index abbd03d897..ca85cbf9c6 100644 --- a/plugins/Favourite/Favourite.php +++ b/plugins/Favourite/Favourite.php @@ -58,7 +58,7 @@ class Favourite extends NoteHandlerPlugin ]); DB::persist($activity); - Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $activity, [], "{$actor->getNickname()} favoured note {$note_id}"]); + Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $activity, [], _m('{nickname} favoured note {note_id}.', ['nickname' => $actor->getNickname(), 'note_id' => $activity->getObjectId()])]); } return $activity; } @@ -79,7 +79,7 @@ class Favourite extends NoteHandlerPlugin ]); DB::persist($activity); - Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $activity, [], "{$actor->getNickname()} unfavoured note {$note_id}"]); + Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $activity, [], _m('{nickname} unfavoured note {note_id}.', ['nickname' => $actor->getNickname(), 'note_id' => $activity->getObjectId()])]); } return $activity; } diff --git a/plugins/RepeatNote/RepeatNote.php b/plugins/RepeatNote/RepeatNote.php index bc3a460f10..5d85cc4f00 100644 --- a/plugins/RepeatNote/RepeatNote.php +++ b/plugins/RepeatNote/RepeatNote.php @@ -85,7 +85,7 @@ class RepeatNote extends NoteHandlerPlugin ]); DB::persist($repeat_activity); - Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $repeat_activity, [], "{$actor->getNickname()} repeated note {$note->getUrl()}"]); + Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $repeat_activity, [], _m('{nickname} repeated note {note_id}.', ['nickname' => $actor->getNickname(), 'note_id' => $repeat_activity->getObjectId()])]); return $repeat_activity; } @@ -119,7 +119,7 @@ class RepeatNote extends NoteHandlerPlugin ]); DB::persist($undo_repeat_activity); - Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $undo_repeat_activity, [], "{$actor->getNickname()} unrepeated note {$note_id}"]); + Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $undo_repeat_activity, [], _m('{nickname} unrepeated note {note_id}.', ['nickname' => $actor->getNickname(), 'note_id' => $note_id])]); return $undo_repeat_activity; } else {