LP-5673: fixed a problem with duplicate notifications in a channel

This commit is contained in:
Дмитрий Пиченикин 2026-03-13 16:24:25 +03:00
parent 0942562085
commit 5fe054333a

View File

@ -201,7 +201,14 @@ func (p *Plugin) notifyGrant(badgeID badgesmodel.BadgeID, granter string, grante
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) {
Tg := p.getT(granterUser.Locale)
p.mm.Post.SendEphemeralPost(granter, &model.Post{Message: Tg("badges.notify.no_permission_channel", "У вас нет прав на отправку уведомления о выдаче в этот канал."), ChannelId: channelID})