fix(assignees): prevent double notifications for assignees
This commit is contained in:
parent
e03920b84a
commit
b2970c6c04
@ -291,11 +291,18 @@ func (s *SendTaskAssignedNotification) Handle(msg *message.Message) (err error)
|
||||
return err
|
||||
}
|
||||
|
||||
notifiedUsers := make(map[int64]bool)
|
||||
|
||||
for _, subscriber := range subscribers {
|
||||
if subscriber.UserID == event.Doer.ID {
|
||||
continue
|
||||
}
|
||||
|
||||
if notifiedUsers[subscriber.UserID] {
|
||||
// Users may be subscribed to the task and the project itself, which leads to double notifications
|
||||
continue
|
||||
}
|
||||
|
||||
n := &TaskAssignedNotification{
|
||||
Doer: event.Doer,
|
||||
Task: &task,
|
||||
@ -306,6 +313,8 @@ func (s *SendTaskAssignedNotification) Handle(msg *message.Message) (err error)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
notifiedUsers[subscriber.UserID] = true
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user