diff --git a/app/channel.go b/app/channel.go index b130e99b1c5..b8de04b2366 100644 --- a/app/channel.go +++ b/app/channel.go @@ -1029,10 +1029,13 @@ func (a *App) PatchChannelModerationsForChannel(channel *model.Channel, channelM } } - a.ForEachChannelMember(channel.Id, func(channelMember model.ChannelMember) error { + cErr := a.ForEachChannelMember(channel.Id, func(channelMember model.ChannelMember) error { a.Srv().Store.Channel().InvalidateAllChannelMembersForUser(channelMember.UserId) return nil }) + if cErr != nil { + return nil, model.NewAppError("PatchChannelModerationsForChannel", "api.channel.patch_channel_moderations.cache_invalidation.error", nil, cErr.Error(), http.StatusInternalServerError) + } return buildChannelModerations(channel.Type, memberRole, guestRole, higherScopedMemberRole, higherScopedGuestRole), nil } diff --git a/i18n/en.json b/i18n/en.json index 2d7e6f025bf..c4fb1a2b22d 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -343,6 +343,10 @@ "id": "api.channel.move_channel.type.invalid", "translation": "Unable to move direct or group message channels" }, + { + "id": "api.channel.patch_channel_moderations.cache_invalidation.error", + "translation": "Error invalidating cache" + }, { "id": "api.channel.patch_channel_moderations.license.error", "translation": "Your license does not support channel moderation"