Merge pull request #5712 from intentionally-left-nil/fix-pulse-crash

Prevent pulse crash when it is not configured
pull/5718/head
daniel 3 months ago committed by GitHub
commit 2bbe7c9d04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -74,19 +74,21 @@ class AppServiceProvider extends ServiceProvider
return $user->is_admin === 1; return $user->is_admin === 1;
}); });
Pulse::user(function ($user) { if (config('pulse.enabled', false)) {
$acct = AccountService::get($user->profile_id, true); Pulse::user(function ($user) {
$acct = AccountService::get($user->profile_id, true);
return $acct ? [ return $acct ? [
'name' => $acct['username'], 'name' => $acct['username'],
'extra' => $user->email, 'extra' => $user->email,
'avatar' => $acct['avatar'], 'avatar' => $acct['avatar'],
] : [ ] : [
'name' => $user->username, 'name' => $user->username,
'extra' => 'DELETED', 'extra' => 'DELETED',
'avatar' => '/storage/avatars/default.jpg', 'avatar' => '/storage/avatars/default.jpg',
]; ];
}); });
}
RateLimiter::for('app-signup', function (Request $request) { RateLimiter::for('app-signup', function (Request $request) {
return Limit::perDay(10)->by($request->ip()); return Limit::perDay(10)->by($request->ip());

Loading…
Cancel
Save