diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2017-07-05 06:32:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-05 06:32:27 +0800 |
commit | 8f8a978e84ec8bbeac22928e6112bc697fa7176d (patch) | |
tree | a82993cfcd1aab059554feeeb1a6256d4640eab4 /webapp/utils | |
parent | 6d6ed309b9b7f2b77cd013583990c6eb88f18aff (diff) | |
download | chat-8f8a978e84ec8bbeac22928e6112bc697fa7176d.tar.gz chat-8f8a978e84ec8bbeac22928e6112bc697fa7176d.tar.bz2 chat-8f8a978e84ec8bbeac22928e6112bc697fa7176d.zip |
[PLT-6838] Restrict channel delete option per permission policy even for last channel member (#6706)
* channel delete option is hidden from the menu unless there is appropriate permissions as set in the policy page
* apply to public channel only and add restriction to API layer
* updated channel deletion
Diffstat (limited to 'webapp/utils')
-rw-r--r-- | webapp/utils/channel_utils.jsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/webapp/utils/channel_utils.jsx b/webapp/utils/channel_utils.jsx index e3a9f0423..c29cea386 100644 --- a/webapp/utils/channel_utils.jsx +++ b/webapp/utils/channel_utils.jsx @@ -190,11 +190,15 @@ export function showManagementOptions(channel, isAdmin, isSystemAdmin, isChannel return true; } -export function showDeleteOption(channel, isAdmin, isSystemAdmin, isChannelAdmin) { +export function showDeleteOption(channel, isAdmin, isSystemAdmin, isChannelAdmin, userCount) { if (global.window.mm_license.IsLicensed !== 'true') { return true; } + if (ChannelStore.isDefault(channel)) { + return false; + } + if (channel.type === Constants.OPEN_CHANNEL) { if (global.window.mm_config.RestrictPublicChannelDeletion === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) { return false; @@ -206,6 +210,9 @@ export function showDeleteOption(channel, isAdmin, isSystemAdmin, isChannelAdmin return false; } } else if (channel.type === Constants.PRIVATE_CHANNEL) { + if (userCount === 1) { + return true; + } if (global.window.mm_config.RestrictPrivateChannelDeletion === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) { return false; } |