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