summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-06-02 23:46:38 +0800
committerCorey Hulen <corey@hulen.com>2017-06-02 08:46:38 -0700
commite7e59cc40f81156d7e5c673cac4589c8fcffdfed (patch)
tree34635280252c83a859fbce9fac17d8678052a3d2 /webapp
parent07c5f0bc2aa1f94305960290b3d5edab59e048ec (diff)
downloadchat-e7e59cc40f81156d7e5c673cac4589c8fcffdfed.tar.gz
chat-e7e59cc40f81156d7e5c673cac4589c8fcffdfed.tar.bz2
chat-e7e59cc40f81156d7e5c673cac4589c8fcffdfed.zip
make channel admins able to delete channel member messages (#6550)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/utils/post_utils.jsx10
1 files changed, 7 insertions, 3 deletions
diff --git a/webapp/utils/post_utils.jsx b/webapp/utils/post_utils.jsx
index b07c024a5..12f9a9e2a 100644
--- a/webapp/utils/post_utils.jsx
+++ b/webapp/utils/post_utils.jsx
@@ -7,6 +7,7 @@ import * as Utils from 'utils/utils.jsx';
import TeamStore from 'stores/team_store.jsx';
import UserStore from 'stores/user_store.jsx';
+import ChannelStore from 'stores/channel_store.jsx';
export function isSystemMessage(post) {
return post.type && (post.type.lastIndexOf(Constants.SYSTEM_MESSAGE_PREFIX) === 0);
@@ -48,14 +49,17 @@ export function getProfilePicSrcForPost(post, timestamp) {
export function canDeletePost(post) {
var isOwner = isPostOwner(post);
- var isAdmin = TeamStore.isTeamAdminForCurrentTeam() || UserStore.isSystemAdminForCurrentUser();
var isSystemAdmin = UserStore.isSystemAdminForCurrentUser();
+ var isTeamAdmin = TeamStore.isTeamAdminForCurrentTeam() || isSystemAdmin;
+ var isChannelAdmin = ChannelStore.isChannelAdminForCurrentChannel() || isTeamAdmin;
+ var isAdmin = isChannelAdmin || isTeamAdmin || isSystemAdmin;
if (global.window.mm_license.IsLicensed === 'true') {
- return (global.window.mm_config.RestrictPostDelete === Constants.PERMISSIONS_DELETE_POST_ALL && (isOwner || isAdmin)) ||
- (global.window.mm_config.RestrictPostDelete === Constants.PERMISSIONS_DELETE_POST_TEAM_ADMIN && isAdmin) ||
+ return (global.window.mm_config.RestrictPostDelete === Constants.PERMISSIONS_DELETE_POST_ALL && (isOwner || isChannelAdmin)) ||
+ (global.window.mm_config.RestrictPostDelete === Constants.PERMISSIONS_DELETE_POST_TEAM_ADMIN && isTeamAdmin) ||
(global.window.mm_config.RestrictPostDelete === Constants.PERMISSIONS_DELETE_POST_SYSTEM_ADMIN && isSystemAdmin);
}
+
return isOwner || isAdmin;
}