LP-5673: fixed a problem with duplicate notifications in a channel
This commit is contained in:
parent
0942562085
commit
5fe054333a
@ -201,7 +201,14 @@ func (p *Plugin) notifyGrant(badgeID badgesmodel.BadgeID, granter string, grante
|
|||||||
p.mm.Log.Debug("notify subscription error", "err", err)
|
p.mm.Log.Debug("notify subscription error", "err", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if inChannel {
|
alreadyNotified := false
|
||||||
|
for _, sub := range subs {
|
||||||
|
if sub == channelID {
|
||||||
|
alreadyNotified = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if inChannel && !alreadyNotified {
|
||||||
if !p.API.HasPermissionToChannel(granter, channelID, model.PERMISSION_CREATE_POST) {
|
if !p.API.HasPermissionToChannel(granter, channelID, model.PERMISSION_CREATE_POST) {
|
||||||
Tg := p.getT(granterUser.Locale)
|
Tg := p.getT(granterUser.Locale)
|
||||||
p.mm.Post.SendEphemeralPost(granter, &model.Post{Message: Tg("badges.notify.no_permission_channel", "У вас нет прав на отправку уведомления о выдаче в этот канал."), ChannelId: channelID})
|
p.mm.Post.SendEphemeralPost(granter, &model.Post{Message: Tg("badges.notify.no_permission_channel", "У вас нет прав на отправку уведомления о выдаче в этот канал."), ChannelId: channelID})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user