summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-06-28 06:44:02 +0100
committerSaturnino Abril <saturnino.abril@gmail.com>2017-06-28 13:44:02 +0800
commit99fc4b0988e941242732feff428468c6df69fe50 (patch)
treea0826c8e0b7a2aa6348628da479537c162a6d492
parent155c6600aa2f7e9e23aa4117326fbbd5fd441da3 (diff)
downloadchat-99fc4b0988e941242732feff428468c6df69fe50.tar.gz
chat-99fc4b0988e941242732feff428468c6df69fe50.tar.bz2
chat-99fc4b0988e941242732feff428468c6df69fe50.zip
PLT-6900: Hide DotMenu container when DotMenu empty. (#6770)
-rw-r--r--webapp/components/post_view/post_info/post_info.jsx2
-rw-r--r--webapp/utils/post_utils.jsx20
2 files changed, 21 insertions, 1 deletions
diff --git a/webapp/components/post_view/post_info/post_info.jsx b/webapp/components/post_view/post_info/post_info.jsx
index f037bf03b..c07a58bc7 100644
--- a/webapp/components/post_view/post_info/post_info.jsx
+++ b/webapp/components/post_view/post_info/post_info.jsx
@@ -192,7 +192,7 @@ export default class PostInfo extends React.PureComponent {
/>
);
- if (dotMenu) {
+ if (PostUtils.shouldShowDotMenu(this.props.post)) {
options = (
<div
ref='dotMenu'
diff --git a/webapp/utils/post_utils.jsx b/webapp/utils/post_utils.jsx
index 991c8fbec..a71aeef31 100644
--- a/webapp/utils/post_utils.jsx
+++ b/webapp/utils/post_utils.jsx
@@ -82,3 +82,23 @@ export function canEditPost(post, editDisableAction) {
}
return canEdit;
}
+
+export function shouldShowDotMenu(post) {
+ if (Utils.isMobile()) {
+ return true;
+ }
+
+ if (!isSystemMessage(post)) {
+ return true;
+ }
+
+ if (canDeletePost(post)) {
+ return true;
+ }
+
+ if (canEditPost(post)) {
+ return true;
+ }
+
+ return false;
+}