From 0e89d9be1d6a2a1ca470f9ca92e0d59e5945ca18 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Thu, 15 Jun 2017 07:45:46 +0800 Subject: create DotMenu components and add dotmenu IDs to posts at center and RHS (#6642) --- webapp/components/rhs_comment.jsx | 200 +++----------------------------------- 1 file changed, 15 insertions(+), 185 deletions(-) (limited to 'webapp/components/rhs_comment.jsx') diff --git a/webapp/components/rhs_comment.jsx b/webapp/components/rhs_comment.jsx index 20734c4f4..73ae70598 100644 --- a/webapp/components/rhs_comment.jsx +++ b/webapp/components/rhs_comment.jsx @@ -7,8 +7,9 @@ import PendingPostOptions from 'components/post_view/components/pending_post_opt import PostMessageContainer from 'components/post_view/components/post_message_container.jsx'; import ProfilePicture from 'components/profile_picture.jsx'; import ReactionListContainer from 'components/post_view/components/reaction_list_container.jsx'; -import RhsDropdown from 'components/rhs_dropdown.jsx'; import PostFlagIcon from 'components/common/post_flag_icon.jsx'; +import DotMenu from 'components/dot_menu/dot_menu.jsx'; +import EmojiPickerOverlay from 'components/emoji_picker/emoji_picker_overlay.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; import {flagPost, unflagPost, pinPost, unpinPost, addReaction} from 'actions/post_actions.jsx'; @@ -17,19 +18,13 @@ import TeamStore from 'stores/team_store.jsx'; import * as Utils from 'utils/utils.jsx'; import * as PostUtils from 'utils/post_utils.jsx'; - import Constants from 'utils/constants.jsx'; -import DelayedAction from 'utils/delayed_action.jsx'; - -import {FormattedMessage} from 'react-intl'; - -import EmojiPickerOverlay from 'components/emoji_picker/emoji_picker_overlay.jsx'; import loadingGif from 'images/load.gif'; -import PropTypes from 'prop-types'; - import React from 'react'; +import PropTypes from 'prop-types'; +import {FormattedMessage} from 'react-intl'; import {Link} from 'react-router/es6'; export default class RhsComment extends React.Component { @@ -45,10 +40,6 @@ export default class RhsComment extends React.Component { this.reactEmojiClick = this.reactEmojiClick.bind(this); this.handleDropdownOpened = this.handleDropdownOpened.bind(this); - this.canEdit = false; - this.canDelete = false; - this.editDisableAction = new DelayedAction(this.handleEditDisable); - this.state = { currentTeamDisplayName: TeamStore.getCurrent().name, width: '', @@ -75,10 +66,6 @@ export default class RhsComment extends React.Component { GlobalActions.showGetPostLinkModal(this.props.post); } - handleEditDisable() { - this.canEdit = false; - } - removePost() { GlobalActions.emitRemovePost(this.props.post); } @@ -160,173 +147,6 @@ export default class RhsComment extends React.Component { unpinPost(this.props.post.channel_id, this.props.post.id); } - createDropdown(isSystemMessage) { - const post = this.props.post; - - if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING) { - return ''; - } - - this.canDelete = PostUtils.canDeletePost(post); - this.canEdit = PostUtils.canEditPost(post, this.editDisableAction); - - var dropdownContents = []; - - if (Utils.isMobile()) { - if (this.props.isFlagged) { - dropdownContents.push( -
  • - - - -
  • - ); - } else { - dropdownContents.push( -
  • - - - -
  • - ); - } - } - - if (!isSystemMessage) { - dropdownContents.push( -
  • - - - -
  • - ); - - if (post.is_pinned) { - dropdownContents.push( -
  • - - - -
  • - ); - } else { - dropdownContents.push( -
  • - - - -
  • - ); - } - } - - if (this.canDelete) { - dropdownContents.push( -
  • - { - e.preventDefault(); - GlobalActions.showDeletePostModal(post, 0); - }} - > - - -
  • - ); - } - - if (this.canEdit) { - dropdownContents.push( -
  • - - - -
  • - ); - } - - if (dropdownContents.length === 0) { - return ''; - } - - return ( - - ); - } - timeTag(post, timeOptions) { return (