diff --git a/webapp/channels/src/components/admin_console/team_channel_settings/channel/details/channel_details.tsx b/webapp/channels/src/components/admin_console/team_channel_settings/channel/details/channel_details.tsx index f616391e23..dc9d2b0e4b 100644 --- a/webapp/channels/src/components/admin_console/team_channel_settings/channel/details/channel_details.tsx +++ b/webapp/channels/src/components/admin_console/team_channel_settings/channel/details/channel_details.tsx @@ -579,24 +579,35 @@ export default class ChannelDetails extends React.PureComponent 0) { - await actions.assignChannelToAccessControlPolicy(accessControlPolicies[0].id, channelID).catch((error) => { - this.setState({ - serverError: , - saving: false, - saveNeeded: true, + if (accessControlPolicies.length === 0) { + serverError = ( + } + /> + ); + saveNeeded = true; + this.setState({serverError, saving: false, saveNeeded}); + actions.setNavigationBlocked(saveNeeded); + return; + } + + if (accessControlPolicies.length > 0) { + await actions.assignChannelToAccessControlPolicy(accessControlPolicies[0].id, channelID).catch((error) => { + serverError = ; + saveNeeded = true; }); - actions.setNavigationBlocked(true); - }); + } } else { await actions.deleteAccessControlPolicy(channelID).catch((error) => { - this.setState({ - serverError: , - saving: false, - saveNeeded: true, - }); + if (error.message && !error.message.includes('not found')) { + serverError = ; + saveNeeded = true; + } }); } diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index 4e91743ed2..a97f370b29 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -531,6 +531,7 @@ "admin.cacheSettings.redisPasswordDesc": "The password of the Redis server.", "admin.cacheSettings.title": "Cache Settings", "admin.channel_details.policy_public_error": "You cannot assign a policy to a public channel.", + "admin.channel_details.policy_required_error": "You must select an access policy when attribute-based channel access is enabled.", "admin.channel_details.policy_synced_error": "You cannot assign a policy to a synced channel.", "admin.channel_list.archived": "Archived", "admin.channel_list.attributed_based": "Attribute Based",