mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Better slack alert validation
This commit is contained in:
parent
7cf7c5fcef
commit
241ad25e2f
@ -126,7 +126,7 @@ class UpdateGroupInformation extends Command
|
||||
return;
|
||||
}
|
||||
if (0 !== $result) {
|
||||
$this->friendlyPositive(sprintf('Moved %d %s objects to the correct group.', $result, str_replace('FireflyIII\\Models\\', '', $className)));
|
||||
$this->friendlyPositive(sprintf('User #%d: Moved %d %s objects to the correct group.', $user->id, $result, str_replace('FireflyIII\\Models\\', '', $className)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,9 +99,7 @@ class TestNotification extends Notification
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
/** @var User|null $user */
|
||||
$user = auth()->user();
|
||||
$slackUrl = null === $user ? '' : (string)app('preferences')->getForUser(auth()->user(), 'slack_webhook_url', '')->data;
|
||||
$slackUrl = app('fireflyconfig')->get('slack_webhook_url', '')->data;
|
||||
if (UrlValidator::isValidWebhookURL($slackUrl)) {
|
||||
return ['mail', 'slack'];
|
||||
}
|
||||
|
@ -102,9 +102,7 @@ class UserInvitation extends Notification
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
/** @var User|null $user */
|
||||
$user = auth()->user();
|
||||
$slackUrl = null === $user ? '' : (string)app('preferences')->getForUser(auth()->user(), 'slack_webhook_url', '')->data;
|
||||
$slackUrl = app('fireflyconfig')->get('slack_webhook_url', '')->data;
|
||||
if (UrlValidator::isValidWebhookURL($slackUrl)) {
|
||||
return ['mail', 'slack'];
|
||||
}
|
||||
|
@ -99,9 +99,7 @@ class UserRegistration extends Notification
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
/** @var User|null $user */
|
||||
$user = auth()->user();
|
||||
$slackUrl = null === $user ? '' : (string)app('preferences')->getForUser(auth()->user(), 'slack_webhook_url', '')->data;
|
||||
$slackUrl = app('fireflyconfig')->get('slack_webhook_url', '')->data;
|
||||
if (UrlValidator::isValidWebhookURL($slackUrl)) {
|
||||
return ['mail', 'slack'];
|
||||
}
|
||||
|
@ -103,9 +103,7 @@ class VersionCheckResult extends Notification
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
/** @var User|null $user */
|
||||
$user = auth()->user();
|
||||
$slackUrl = null === $user ? '' : (string)app('preferences')->getForUser(auth()->user(), 'slack_webhook_url', '')->data;
|
||||
$slackUrl = app('fireflyconfig')->get('slack_webhook_url', '')->data;
|
||||
if (UrlValidator::isValidWebhookURL($slackUrl)) {
|
||||
return ['mail', 'slack'];
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
|
||||
|
||||
/**
|
||||
* Class UserLogin
|
||||
*/
|
||||
|
@ -480,15 +480,16 @@ class User extends Authenticatable
|
||||
if ($notification instanceof TestNotification) {
|
||||
return app('fireflyconfig')->get('slack_webhook_url', '')->data;
|
||||
}
|
||||
if ($notification instanceof UserInvitation) {
|
||||
return app('fireflyconfig')->get('slack_webhook_url', '')->data;
|
||||
}
|
||||
if ($notification instanceof UserRegistration) {
|
||||
return app('fireflyconfig')->get('slack_webhook_url', '')->data;
|
||||
}
|
||||
if ($notification instanceof VersionCheckResult) {
|
||||
return app('fireflyconfig')->get('slack_webhook_url', '')->data;
|
||||
}
|
||||
if ($notification instanceof UserInvitation) {
|
||||
return app('fireflyconfig')->get('slack_webhook_url', '')->data;
|
||||
}
|
||||
|
||||
return app('preferences')->getForUser($this, 'slack_webhook_url', '')->data;
|
||||
}
|
||||
|
||||
@ -598,7 +599,7 @@ class User extends Authenticatable
|
||||
*/
|
||||
public function userGroup(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(UserGroup::class, );
|
||||
return $this->belongsTo(UserGroup::class,);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +91,7 @@
|
||||
"laravel/framework": "^10",
|
||||
"laravel/passport": "11.*",
|
||||
"laravel/sanctum": "^3.3",
|
||||
"laravel/slack-notification-channel": "^3",
|
||||
"laravel/slack-notification-channel": "^3.0",
|
||||
"laravel/ui": "^4.2",
|
||||
"league/commonmark": "2.*",
|
||||
"league/csv": "^9.10",
|
||||
|
2
composer.lock
generated
2
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "351a9da77c2fa38c0f4f13ef059926ee",
|
||||
"content-hash": "639b971ea13ea3e6ed2f57f862a195b8",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
|
Loading…
Reference in New Issue
Block a user