Added native os notifications

This commit is contained in:
2026-07-02 00:33:28 +10:00
parent 84379baf6a
commit 027437dc9b
13 changed files with 451 additions and 117 deletions
+19 -9
View File
@@ -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']);
}