mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-16 21:18:19 +01:00
Granular notification strings. Closes #2303
This commit is contained in:
parent
a81c87bed7
commit
c1831d8559
@ -77,17 +77,17 @@ class ComponentStatusChangedNotification extends Notification
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
$content = trans('notifications.component.status_update.content', [
|
||||
$content = trans('notifications.component.status_update.mail.content', [
|
||||
'name' => $this->component->name,
|
||||
'old_status' => $this->component->human_status,
|
||||
'new_status' => trans("cachet.components.status.{$this->status}"),
|
||||
]);
|
||||
|
||||
return (new MailMessage())
|
||||
->subject(trans('notifications.component.status_update.subject'))
|
||||
->greeting(trans('notifications.component.status_update.title'))
|
||||
->subject(trans('notifications.component.status_update.mail.subject'))
|
||||
->greeting(trans('notifications.component.status_update.mail.title'))
|
||||
->line($content)
|
||||
->action('View', cachet_route('status-page'))
|
||||
->action(trans('notifications.component.status_update.mail.action'), cachet_route('status-page'))
|
||||
->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ class ComponentStatusChangedNotification extends Notification
|
||||
*/
|
||||
public function toNexmo($notifiable)
|
||||
{
|
||||
$content = trans('notifications.component.status_update.content', [
|
||||
$content = trans('notifications.component.status_update.sms.content', [
|
||||
'name' => $this->component->name,
|
||||
'old_status' => $this->component->human_status,
|
||||
'new_status' => trans("cachet.components.status.{$this->status}"),
|
||||
@ -118,7 +118,7 @@ class ComponentStatusChangedNotification extends Notification
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
$content = trans('notifications.component.status_update.content', [
|
||||
$content = trans('notifications.component.status_update.slack.content', [
|
||||
'name' => $this->component->name,
|
||||
'old_status' => $this->component->human_status,
|
||||
'new_status' => trans("cachet.components.status.{$this->status}"),
|
||||
@ -136,7 +136,7 @@ class ComponentStatusChangedNotification extends Notification
|
||||
|
||||
return (new SlackMessage())
|
||||
->$status()
|
||||
->content(trans('notifications.component.status_update.title'))
|
||||
->content(trans('notifications.component.status_update.slack.title'))
|
||||
->attachment(function ($attachment) use ($content, $notifiable) {
|
||||
$attachment->title($content, cachet_route('status-page'))
|
||||
->fields(array_filter([
|
||||
|
@ -69,15 +69,15 @@ class NewIncidentNotification extends Notification
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
$content = trans('notifications.incident.new.content', [
|
||||
$content = trans('notifications.incident.new.mail.content', [
|
||||
'name' => $this->incident->name,
|
||||
]);
|
||||
|
||||
return (new MailMessage())
|
||||
->subject(trans('notifications.incident.new.subject'))
|
||||
->greeting(trans('notifications.incident.new.title', ['app_name' => Config::get('setting.app_name')]))
|
||||
->subject(trans('notifications.incident.new.mail.subject'))
|
||||
->greeting(trans('notifications.incident.new.mail.greeting', ['app_name' => Config::get('setting.app_name')]))
|
||||
->line($content)
|
||||
->action('View Incident', cachet_route('incident', [$this->incident]))
|
||||
->action(trans('notifications.incident.new.mail.action'), cachet_route('incident', [$this->incident]))
|
||||
->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
|
||||
}
|
||||
|
||||
@ -90,11 +90,9 @@ class NewIncidentNotification extends Notification
|
||||
*/
|
||||
public function toNexmo($notifiable)
|
||||
{
|
||||
$content = trans('notifications.incident.new.content', [
|
||||
return (new NexmoMessage())->content(trans('notifications.incident.new.sms.content', [
|
||||
'name' => $this->incident->name,
|
||||
]);
|
||||
|
||||
return (new NexmoMessage())->content($content);
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,8 +104,8 @@ class NewIncidentNotification extends Notification
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
$content = trans('notifications.incident.new.content', [
|
||||
'name' => $this->incident->name,
|
||||
$content = trans('notifications.incident.new.slack.content', [
|
||||
'app_name' => Config::get('setting.app_name')
|
||||
]);
|
||||
|
||||
$status = 'info';
|
||||
@ -122,9 +120,9 @@ class NewIncidentNotification extends Notification
|
||||
|
||||
return (new SlackMessage())
|
||||
->$status()
|
||||
->content(trans('notifications.incident.new.title', ['app_name' => Config::get('setting.app_name')]))
|
||||
->content($content)
|
||||
->attachment(function ($attachment) use ($content) {
|
||||
$attachment->title($content)
|
||||
$attachment->title(trans('notifications.incident.new.slack.title', [$this->incident->name]))
|
||||
->timestamp($this->incident->getWrappedObject()->occurred_at)
|
||||
->fields(array_filter([
|
||||
'ID' => "#{$this->incident->id}",
|
||||
|
@ -69,19 +69,19 @@ class IncidentUpdatedNotification extends Notification
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
$content = trans('notifications.incident.update.content', [
|
||||
$content = trans('notifications.incident.update.mail.content', [
|
||||
'name' => $this->update->incident->name,
|
||||
'time' => $this->update->created_at_diff,
|
||||
]);
|
||||
|
||||
return (new MailMessage())
|
||||
->subject(trans('notifications.incident.update.subject'))
|
||||
->greeting(trans('notifications.incident.update.title', [
|
||||
->subject(trans('notifications.incident.update.mail.subject'))
|
||||
->greeting(trans('notifications.incident.update.mail.title', [
|
||||
'name' => $this->update->incident->name,
|
||||
'new_status' => $this->update->human_status,
|
||||
]))
|
||||
->line($content)
|
||||
->action('View Incident', cachet_route('incident', [$this->update->incident]))
|
||||
->action(trans('notifications.incident.update.mail.action'), cachet_route('incident', [$this->update->incident]))
|
||||
->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ class IncidentUpdatedNotification extends Notification
|
||||
*/
|
||||
public function toNexmo($notifiable)
|
||||
{
|
||||
$content = trans('notifications.incident.update.content', [
|
||||
$content = trans('notifications.incident.update.sms.content', [
|
||||
'name' => $this->update->incident->name,
|
||||
]);
|
||||
|
||||
@ -110,7 +110,7 @@ class IncidentUpdatedNotification extends Notification
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
$content = trans('notifications.incident.update.content', [
|
||||
$content = trans('notifications.incident.update.slack.content', [
|
||||
'name' => $this->update->incident->name,
|
||||
]);
|
||||
|
||||
@ -126,12 +126,12 @@ class IncidentUpdatedNotification extends Notification
|
||||
|
||||
return (new SlackMessage())
|
||||
->$status()
|
||||
->content(trans('notifications.incident.update.title', [
|
||||
'name' => $this->update->incident->name,
|
||||
'new_status' => $this->update->human_status,
|
||||
]))
|
||||
->content($content)
|
||||
->attachment(function ($attachment) use ($content) {
|
||||
$attachment->title($content)
|
||||
$attachment->title(trans('notifications.incident.update.slack.title', [
|
||||
'name' => $this->update->incident->name,
|
||||
'new_status' => $this->update->human_status,
|
||||
]))
|
||||
->timestamp($this->update->getWrappedObject()->created_at)
|
||||
->fields(array_filter([
|
||||
'ID' => "#{$this->update->id}",
|
||||
|
@ -68,16 +68,16 @@ class NewScheduleNotification extends Notification
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
$content = trans('notifications.schedule.new.content', [
|
||||
$content = trans('notifications.schedule.new.mail.content', [
|
||||
'name' => $this->schedule->name,
|
||||
'date' => $this->schedule->scheduled_at_formatted,
|
||||
]);
|
||||
|
||||
return (new MailMessage())
|
||||
->subject(trans('notifications.schedule.new.subject'))
|
||||
->greeting(trans('notifications.schedule.new.title'))
|
||||
->subject(trans('notifications.schedule.new.mail.subject'))
|
||||
->greeting(trans('notifications.schedule.new.mail.title'))
|
||||
->line($content)
|
||||
->action('View Schedule', cachet_route('schedule', [$this->schedule]))
|
||||
->action(trans('notifications.schedule.new.mail.action'), cachet_route('schedule', [$this->schedule]))
|
||||
->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ class NewScheduleNotification extends Notification
|
||||
*/
|
||||
public function toNexmo($notifiable)
|
||||
{
|
||||
$content = trans('notifications.schedule.new.content', [
|
||||
$content = trans('notifications.schedule.new.sms.content', [
|
||||
'name' => $this->schedule->name,
|
||||
'date' => $this->schedule->scheduled_at_formatted,
|
||||
]);
|
||||
@ -107,13 +107,13 @@ class NewScheduleNotification extends Notification
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
$content = trans('notifications.schedule.new.content', [
|
||||
$content = trans('notifications.schedule.new.slack.content', [
|
||||
'name' => $this->schedule->name,
|
||||
'date' => $this->schedule->scheduled_at_formatted,
|
||||
]);
|
||||
|
||||
return (new SlackMessage())
|
||||
->content(trans('notifications.schedule.new.title'))
|
||||
->content(trans('notifications.schedule.new.slack.title'))
|
||||
->attachment(function ($attachment) use ($content) {
|
||||
$attachment->title($content)
|
||||
->timestamp($this->schedule->getWrappedObject()->scheduled_at)
|
||||
|
@ -47,9 +47,9 @@ class VerifySubscriptionNotification extends Notification
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage())
|
||||
->subject(trans('notifications.subscriber.verify.subject'))
|
||||
->greeting(trans('notifications.subscriber.verify.title', ['app_name' => Config::get('setting.app_name')]))
|
||||
->action(trans('notifications.subscriber.verify.action'), cachet_route('subscribe.verify', ['code' => $notifiable->verify_code]))
|
||||
->line(trans('notifications.subscriber.verify.content', ['app_name' => Config::get('setting.app_name')]));
|
||||
->subject(trans('notifications.subscriber.verify.mail.subject'))
|
||||
->greeting(trans('notifications.subscriber.verify.mail.title', ['app_name' => Config::get('setting.app_name')]))
|
||||
->action(trans('notifications.subscriber.verify.mail.action'), cachet_route('subscribe.verify', ['code' => $notifiable->verify_code]))
|
||||
->line(trans('notifications.subscriber.verify.mail.content', ['app_name' => Config::get('setting.app_name')]));
|
||||
}
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ class SystemTestNotification extends Notification
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage())
|
||||
->subject(trans('notifications.system.test.subject'))
|
||||
->greeting(trans('notifications.system.test.title'))
|
||||
->line(trans('notifications.system.test.content'));
|
||||
->subject(trans('notifications.system.test.mail.subject'))
|
||||
->greeting(trans('notifications.system.test.mail.title'))
|
||||
->line(trans('notifications.system.test.mail.content'));
|
||||
}
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ class InviteUserNotification extends Notification
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage())
|
||||
->subject(trans('notifications.user.invite.subject'))
|
||||
->greeting(trans('notifications.user.invite.title', ['app_name' => Config::get('setting.app_name')]))
|
||||
->action(trans('notifications.user.invite.action'), cachet_route('signup.invite', [$notifiable->code]))
|
||||
->line(trans('notifications.user.invite.content', ['app_name' => Config::get('setting.app_name')]));
|
||||
->subject(trans('notifications.user.invite.mail.subject'))
|
||||
->greeting(trans('notifications.user.invite.mail.title', ['app_name' => Config::get('setting.app_name')]))
|
||||
->action(trans('notifications.user.invite.mail.action'), cachet_route('signup.invite', [$notifiable->code]))
|
||||
->line(trans('notifications.user.invite.mail.content', ['app_name' => Config::get('setting.app_name')]));
|
||||
}
|
||||
}
|
||||
|
@ -12,54 +12,97 @@
|
||||
return [
|
||||
'component' => [
|
||||
'status_update' => [
|
||||
'subject' => 'Component Status Updated',
|
||||
'title' => 'A component\'s status was updated!',
|
||||
'content' => ':name status changed from :old_status to :new_status.',
|
||||
'mail' => [
|
||||
'subject' => 'Component Status Updated',
|
||||
'greeting' => 'A component\'s status was updated!',
|
||||
'content' => ':name status changed from :old_status to :new_status.',
|
||||
'action' => 'View',
|
||||
],
|
||||
'slack' => [
|
||||
'title' => 'Component Status Updated',
|
||||
'content' => ':name status changed from :old_status to :new_status.',
|
||||
],
|
||||
'sms' => [
|
||||
'content' => ':name status changed from :old_status to :new_status.',
|
||||
],
|
||||
],
|
||||
],
|
||||
'incident' => [
|
||||
'new' => [
|
||||
'subject' => 'New Incident Reported',
|
||||
'content' => ':name was reported',
|
||||
'title' => 'A new incident was reported at :app_name status page.',
|
||||
'action' => 'View',
|
||||
'mail' => [
|
||||
'subject' => 'New Incident Reported',
|
||||
'greeting' => 'A new incident was reported at :app_name.',
|
||||
'content' => 'Incident :name was reported',
|
||||
'action' => 'View',
|
||||
],
|
||||
'slack' => [
|
||||
'title' => 'Incident :name Reported',
|
||||
'content' => 'A new incident was reported at :app_name',
|
||||
],
|
||||
'sms' => [
|
||||
'content' => 'A new incident was reported at :app_name.',
|
||||
],
|
||||
],
|
||||
'update' => [
|
||||
'subject' => 'Incident Updated',
|
||||
'content' => ':name was updated',
|
||||
'title' => ':name was updated to :new_status',
|
||||
'action' => 'View',
|
||||
'mail' => [
|
||||
'subject' => 'Incident Updated',
|
||||
'content' => ':name was updated',
|
||||
'title' => ':name was updated to :new_status',
|
||||
'action' => 'View',
|
||||
],
|
||||
'slack' => [
|
||||
'title' => ':name Updated',
|
||||
'content' => ':name was updated to :new_status',
|
||||
],
|
||||
'sms' => [
|
||||
'content' => 'Incident :name was updated',
|
||||
],
|
||||
],
|
||||
],
|
||||
'schedule' => [
|
||||
'new' => [
|
||||
'subject' => 'New Schedule Created',
|
||||
'content' => ':name was scheduled for :date',
|
||||
'title' => 'A new scheduled maintenance was created.',
|
||||
'action' => 'View',
|
||||
'mail' => [
|
||||
'subject' => 'New Schedule Created',
|
||||
'content' => ':name was scheduled for :date',
|
||||
'title' => 'A new scheduled maintenance was created.',
|
||||
'action' => 'View',
|
||||
],
|
||||
'slack' => [
|
||||
'title' => 'New Schedule Created!.'
|
||||
'content' => ':name was scheduled for :date',
|
||||
],
|
||||
'sms' => [
|
||||
'content' => ':name was scheduled for :date',
|
||||
],
|
||||
],
|
||||
],
|
||||
'subscriber' => [
|
||||
'verify' => [
|
||||
'subject' => 'Verify Your Subscription',
|
||||
'content' => 'Click to verify your subscription to :app_name status page.',
|
||||
'title' => 'Verify your subscription to :app_name status page.',
|
||||
'action' => 'Verify',
|
||||
'mail' => [
|
||||
'subject' => 'Verify Your Subscription',
|
||||
'content' => 'Click to verify your subscription to :app_name status page.',
|
||||
'title' => 'Verify your subscription to :app_name status page.',
|
||||
'action' => 'Verify',
|
||||
],
|
||||
],
|
||||
],
|
||||
'system' => [
|
||||
'test' => [
|
||||
'subject' => 'Ping from Cachet!',
|
||||
'content' => 'This is a test notification from Cachet!',
|
||||
'title' => '🔔',
|
||||
'mail' => [
|
||||
'subject' => 'Ping from Cachet!',
|
||||
'content' => 'This is a test notification from Cachet!',
|
||||
'title' => '🔔',
|
||||
],
|
||||
],
|
||||
],
|
||||
'user' => [
|
||||
'invite' => [
|
||||
'subject' => 'Your invitation is inside...',
|
||||
'content' => 'You have been invited to join :app_name status page.',
|
||||
'title' => 'You\'re invited to join :app_name status page.',
|
||||
'action' => 'Accept',
|
||||
'mail' => [
|
||||
'subject' => 'Your invitation is inside...',
|
||||
'content' => 'You have been invited to join :app_name status page.',
|
||||
'title' => 'You\'re invited to join :app_name status page.',
|
||||
'action' => 'Accept',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user