Clean up and fix notifications.

This commit is contained in:
James Cole
2024-12-14 07:52:02 +01:00
parent 5f1502eea7
commit 5520992861
20 changed files with 195 additions and 25 deletions

View File

@@ -88,7 +88,7 @@ class BillReminder extends Notification
$bill = $this->bill;
$url = route('bills.show', [$bill->id]);
return (new SlackMessage())
return new SlackMessage()
->warning()
->attachment(static function ($attachment) use ($bill, $url): void {
$attachment->title((string) trans('firefly.visit_bill', ['name' => $bill->name]), $url);

View File

@@ -63,7 +63,7 @@ class NewAccessToken extends Notification
*/
public function toSlack(User $notifiable)
{
return (new SlackMessage())->content((string) trans('email.access_token_created_body'));
return new SlackMessage()->content((string) trans('email.access_token_created_body'));
}
/**

View File

@@ -73,7 +73,7 @@ class RuleActionFailed extends Notification
$ruleTitle = $this->ruleTitle;
$ruleLink = $this->ruleLink;
return (new SlackMessage())->content($this->message)->attachment(static function ($attachment) use ($groupTitle, $groupLink): void {
return new SlackMessage()->content($this->message)->attachment(static function ($attachment) use ($groupTitle, $groupLink): void {
$attachment->title((string) trans('rules.inspect_transaction', ['title' => $groupTitle]), $groupLink);
})->attachment(static function ($attachment) use ($ruleTitle, $ruleLink): void {
$attachment->title((string) trans('rules.inspect_rule', ['title' => $ruleTitle]), $ruleLink);

View File

@@ -94,7 +94,7 @@ class UserLogin extends Notification
$host = $hostName;
}
return (new SlackMessage())->content((string) trans('email.slack_login_from_new_ip', ['host' => $host, 'ip' => $this->ip]));
return new SlackMessage()->content((string) trans('email.slack_login_from_new_ip', ['host' => $host, 'ip' => $this->ip]));
}
/**