PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.0
2.11.0 2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 All 78 releases
← All changes | app/Http/Controllers/NotificationsController.php +8 -4 2.4.012.10.0 View file →
@@ -31,9 +31,10 @@
31 31 ->orderBy('updated_at', 'DESC')
32 32 ->paginate();
33 33
34 34 $data = [
35 - 'notifications' => $notifications
35 + 'notifications' => $notifications,
36 + 'unread_count' => Notification::byStatus('unread', $user->ID)->count()
36 37 ];
37 38 return apply_filters('fluent_community/notifications_api_response', $data, $request->all());
38 39 }
39 40
@@ -53,8 +54,9 @@
53 54 $data = [
54 55 'notifications' => $unreadNotifications,
55 56 'unread_count' => Notification::byStatus('unread', get_current_user_id())->count()
56 57 ];
58 +
57 59 return apply_filters('fluent_community/unread_notifications_api_response', $data, $request->all());
58 60 }
59 61
60 62 public function markAllRead(Request $request)
@@ -72,10 +74,12 @@
72 74 {
73 75 $notification = Notification::findOrFail($notification_id);
74 76
75 77 NotificationSubscriber::whereHas('notification', function ($query) use ($notification) {
76 - return $query->where('id', $notification->id)
77 - ->orWhere('feed_id', $notification->feed_id);
78 + $query->where('id', $notification->id);
79 + if ($notification->feed_id) {
80 + $query->orWhere('feed_id', $notification->feed_id);
81 + }
78 82 })
79 83 ->where('user_id', get_current_user_id())
80 84 ->update(['is_read' => 1]);
81 85
@@ -85,9 +89,9 @@
85 89 }
86 90
87 91 public function markAsReadByFeedId(Request $request, $feedId)
88 92 {
89 - $feed = Feed::findOrfail($feedId);
93 + $feed = Feed::withoutGlobalScopes()->findOrFail($feedId);
90 94
91 95 NotificationSubscriber::whereHas('notification', function ($query) use ($feed) {
92 96 return $query->where('feed_id', $feed->id);
93 97 })