Skip to content

Commit

Permalink
Merge pull request #852 from peer-42seoul/hotfic-notification-user-co…
Browse files Browse the repository at this point in the history
…unter-minus-issue

hotfix-minus-problem!
  • Loading branch information
Paul2021-R authored Feb 13, 2024
2 parents 32d6331 + bc38ed7 commit 2e1dd91
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ public void deleteNotificationAll(User user, NotificationType type) {
deleteTarget.add(target);
counter.getAndSet(counter.get() - 1);
});
if (counter.get() < 0)
counter.getAndSet(0);
user.setAlarmCounter(counter.get());
this.notificationTargetRepository.deleteAll(deleteTarget);
this.userRepository.save(user);
Expand All @@ -139,6 +141,8 @@ public void deleteNotification(User user, Long eventId) {
if (target.getUserList().isEmpty())
this.notificationTargetRepository.delete(target);
Integer value = user.getAlarmCounter() - 1;
if (value < 0)
value = 0;
user.setAlarmCounter(value);
this.userRepository.save(user);
}
Expand Down

0 comments on commit 2e1dd91

Please sign in to comment.