mirror of
https://github.com/pelican-dev/panel.git
synced 2025-12-19 21:31:25 +01:00
Use recipient language for database notifications (#2008)
This commit is contained in:
parent
9d1e7f510f
commit
5a47948a93
@ -14,14 +14,16 @@ class ServerInstalledListener
|
||||
{
|
||||
$event->server->loadMissing('user');
|
||||
|
||||
$locale = $event->server->user->language ?? 'en';
|
||||
|
||||
Notification::make()
|
||||
->status($event->successful ? 'success' : 'danger')
|
||||
->title(trans('notifications.' . ($event->initialInstall ? 'installation' : 'reinstallation') . '_' . ($event->successful ? 'completed' : 'failed')))
|
||||
->body(trans('server/setting.server_info.server_name', ['name' => $event->server->name]))
|
||||
->title(trans('notifications.' . ($event->initialInstall ? 'installation' : 'reinstallation') . '_' . ($event->successful ? 'completed' : 'failed'), locale: $locale))
|
||||
->body(trans('server/setting.server_info.server_name', ['name' => $event->server->name], $locale))
|
||||
->actions([
|
||||
Action::make('view')
|
||||
->button()
|
||||
->label(trans('notifications.open_server'))
|
||||
->label(trans('notifications.open_server', locale: $locale))
|
||||
->markAsRead()
|
||||
->url(fn () => Console::getUrl(panel: 'server', tenant: $event->server)),
|
||||
])
|
||||
|
||||
@ -15,13 +15,15 @@ class SubUserAddedListener
|
||||
$event->subuser->loadMissing('server');
|
||||
$event->subuser->loadMissing('user');
|
||||
|
||||
$locale = $event->subuser->user->language ?? 'en';
|
||||
|
||||
Notification::make()
|
||||
->title(trans('notifications.user_added.title'))
|
||||
->body(trans('notifications.user_added.body', ['server' => $event->subuser->server->name]))
|
||||
->title(trans('notifications.user_added.title', locale: $locale))
|
||||
->body(trans('notifications.user_added.body', ['server' => $event->subuser->server->name], $locale))
|
||||
->actions([
|
||||
Action::make('view')
|
||||
->button()
|
||||
->label(trans('notifications.open_server'))
|
||||
->label(trans('notifications.open_server', locale: $locale))
|
||||
->markAsRead()
|
||||
->url(fn () => Console::getUrl(panel: 'server', tenant: $event->subuser->server)),
|
||||
])
|
||||
|
||||
@ -10,9 +10,11 @@ class SubUserRemovedListener
|
||||
{
|
||||
public function handle(SubUserRemoved $event): void
|
||||
{
|
||||
$locale = $event->user->language ?? 'en';
|
||||
|
||||
Notification::make()
|
||||
->title(trans('notifications.user_removed.title'))
|
||||
->body(trans('notifications.user_removed.body', ['server' => $event->server->name]))
|
||||
->title(trans('notifications.user_removed.title', locale: $locale))
|
||||
->body(trans('notifications.user_removed.body', ['server' => $event->server->name], $locale))
|
||||
->sendToDatabase($event->user);
|
||||
|
||||
$event->user->notify(new RemovedFromServer($event->server));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user