Skip to content

Commit

Permalink
retrieve challengeOwner id for challenge comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwarz2030 committed Nov 16, 2022
1 parent 46120e4 commit 32faeaa
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,14 @@ class NotificationService @Inject() (
// match [@username] (username may contain spaces) or @username (no spaces allowed)
val mentionRegex = """\[@([^\]]+)\]|@([\w\d_-]+)""".r.unanchored

val challengeOwner = this.serviceManager.user.retrieveByOSMId(challenge.general.owner).get

// Challenge owners should be notified everytime a challenge comment is posted unless its their comment
if (fromUser.id != challenge.general.owner) {
if (fromUser.id != challengeOwner.id) {
this.addNotification(
UserNotification(
-1,
userId = challenge.general.owner,
userId = challengeOwner.id,
notificationType = UserNotification.NOTIFICATION_TYPE_CHALLENGE_COMMENT,
fromUsername = Some(fromUser.osmProfile.displayName),
taskId = None,
Expand All @@ -217,7 +219,7 @@ class NotificationService @Inject() (
this.serviceManager.user.retrieveByOSMUsername(username, User.superUser) match {
case Some(mentionedUser) =>
// Since challenge owners always get notified, don't duplicate the notification if they're mentioned
if (mentionedUser.id == challenge.general.owner) {
if (mentionedUser.id == challengeOwner.id) {
return None
}
this.addNotification(
Expand Down

0 comments on commit 32faeaa

Please sign in to comment.