Added native os notifications
This commit is contained in:
@@ -38,6 +38,14 @@ class FollowerController extends Controller
|
||||
if ($existing) {
|
||||
$existing->delete();
|
||||
$this->clearFollowingCache(auth()->user());
|
||||
|
||||
Notification::where('user_id', $user->id)
|
||||
->whereIn('title', ['New follower', 'Follow request'])
|
||||
->where('url', $canView ?? true
|
||||
? '/u/' . auth()->user()->name
|
||||
: '/follow-requests')
|
||||
->delete();
|
||||
|
||||
return response()->json(['status' => 'none']);
|
||||
}
|
||||
|
||||
@@ -51,15 +59,17 @@ class FollowerController extends Controller
|
||||
|
||||
$this->clearFollowingCache(auth()->user());
|
||||
|
||||
Notification::create([
|
||||
'user_id' => $user->id,
|
||||
'title' => $canView ? 'New follower' : 'Follow request',
|
||||
'body' => $canView
|
||||
? auth()->user()->name . ' is now following you.'
|
||||
: auth()->user()->name . ' wants to follow you.',
|
||||
'is_achievement' => false,
|
||||
'url' => $canView ? '/u/' . auth()->user()->name : '/follow-requests',
|
||||
]);
|
||||
if($user->getSetting('notify_on_new_follower')) {
|
||||
Notification::create([
|
||||
'user_id' => $user->id,
|
||||
'title' => $canView ? 'New follower' : 'Follow request',
|
||||
'body' => $canView
|
||||
? auth()->user()->name . ' is now following you.'
|
||||
: auth()->user()->name . ' wants to follow you.',
|
||||
'is_achievement' => false,
|
||||
'url' => $canView ? '/u/' . auth()->user()->name : '/follow-requests',
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json(['status' => $canView ? 'following' : 'requested']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user