Skip to content

Commit

Permalink
Only update notifications that are not already marked as read (#3202)
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland authored Dec 14, 2021
1 parent 10c6694 commit 25dc26b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Notification/NotificationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public function findByUser(User $user, $limit = null, $offset = 0)
*/
public function markAllAsRead(User $user)
{
Notification::where('user_id', $user->id)->update(['read_at' => Carbon::now()]);
Notification::where('user_id', $user->id)
->whereNull('read_at')
->update(['read_at' => Carbon::now()]);
}
}

0 comments on commit 25dc26b

Please sign in to comment.