Add some slack notifications and a todo to fix the rest

This commit is contained in:
James Cole
2023-08-12 20:57:51 +02:00
parent 53f1b0218c
commit 610bc108e7
26 changed files with 346 additions and 41 deletions

View File

@@ -87,21 +87,10 @@ class VersionCheckResult extends Notification
*/
public function toSlack($notifiable)
{
// return (new SlackMessage())->text($this->message)
// ->sectionBlock(function (SectionBlock $block) {
// $button = new ButtonElement('Button');
// $button->url('https://github.com/firefly-iii/firefly-iii/releases');
// $block->accessory($button);
// });
//// ->attachment(function ($attachment) {
//// $attachment->title('Firefly III @ GitHub', 'https://github.com/firefly-iii/firefly-iii/releases');
//// });
return (new SlackMessage())->content($this->message)
->attachment(function ($attachment) {
$attachment->title('Firefly III @ GitHub', 'https://github.com/firefly-iii/firefly-iii/releases');
});
->attachment(function ($attachment) {
$attachment->title('Firefly III @ GitHub', 'https://github.com/firefly-iii/firefly-iii/releases');
});
}
/**
@@ -114,7 +103,7 @@ class VersionCheckResult extends Notification
public function via($notifiable)
{
/** @var User|null $user */
$user = auth()->user();
$user = auth()->user();
$slackUrl = null === $user ? '' : (string)app('preferences')->getForUser(auth()->user(), 'slack_webhook_url', '')->data;
if (str_starts_with($slackUrl, 'https://hooks.slack.com/services/')) {
return ['mail', 'slack'];