From 2d30d24658321bbaa32ebfc181dbdade685fd23d Mon Sep 17 00:00:00 2001 From: Martin Kraft Date: Wed, 17 Mar 2021 20:07:39 -0400 Subject: [PATCH] MM-33402: Handles cache invalidation error. --- app/channel.go | 5 ++++- i18n/en.json | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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"