From d8bd57901e33a7057e26e782e295099ffcc0da89 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 6 Sep 2017 23:04:13 -0700 Subject: Removing webapp --- webapp/components/post_view/post/index.js | 34 ---- webapp/components/post_view/post/post.jsx | 300 ------------------------------ 2 files changed, 334 deletions(-) delete mode 100644 webapp/components/post_view/post/index.js delete mode 100644 webapp/components/post_view/post/post.jsx (limited to 'webapp/components/post_view/post') diff --git a/webapp/components/post_view/post/index.js b/webapp/components/post_view/post/index.js deleted file mode 100644 index 2e7125f34..000000000 --- a/webapp/components/post_view/post/index.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import {connect} from 'react-redux'; - -import {getCurrentUser, getUser, getStatusForUserId} from 'mattermost-redux/selectors/entities/users'; -import {get} from 'mattermost-redux/selectors/entities/preferences'; -import {getPost} from 'mattermost-redux/selectors/entities/posts'; - -import {Preferences} from 'utils/constants.jsx'; - -import Post from './post.jsx'; - -function mapStateToProps(state, ownProps) { - const detailedPost = ownProps.post || {}; - - return { - post: getPost(state, detailedPost.id), - lastPostCount: ownProps.lastPostCount, - user: getUser(state, detailedPost.user_id), - status: getStatusForUserId(state, detailedPost.user_id), - currentUser: getCurrentUser(state), - isFirstReply: Boolean(detailedPost.isFirstReply && detailedPost.commentedOnPost), - highlight: detailedPost.highlight, - consecutivePostByUser: detailedPost.consecutivePostByUser, - previousPostIsComment: detailedPost.previousPostIsComment, - replyCount: detailedPost.replyCount, - isCommentMention: detailedPost.isCommentMention, - center: get(state, Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT) === Preferences.CHANNEL_DISPLAY_MODE_CENTERED, - compactDisplay: get(state, Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.MESSAGE_DISPLAY, Preferences.MESSAGE_DISPLAY_DEFAULT) === Preferences.MESSAGE_DISPLAY_COMPACT - }; -} - -export default connect(mapStateToProps)(Post); diff --git a/webapp/components/post_view/post/post.jsx b/webapp/components/post_view/post/post.jsx deleted file mode 100644 index 25d23c690..000000000 --- a/webapp/components/post_view/post/post.jsx +++ /dev/null @@ -1,300 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import PostHeader from 'components/post_view/post_header'; -import PostBody from 'components/post_view/post_body'; -import ProfilePicture from 'components/profile_picture.jsx'; - -import Constants from 'utils/constants.jsx'; -const ActionTypes = Constants.ActionTypes; -import {Posts} from 'mattermost-redux/constants'; - -import * as Utils from 'utils/utils.jsx'; -import * as PostUtils from 'utils/post_utils.jsx'; -import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; - -import React from 'react'; -import PropTypes from 'prop-types'; - -export default class Post extends React.PureComponent { - static propTypes = { - - /** - * The post to render - */ - post: PropTypes.object.isRequired, - - /** - * The user who created the post - */ - user: PropTypes.object, - - /** - * The status of the poster - */ - status: PropTypes.string, - - /** - * The logged in user - */ - currentUser: PropTypes.object.isRequired, - - /** - * Set to center the post - */ - center: PropTypes.bool, - - /** - * Set to render post compactly - */ - compactDisplay: PropTypes.bool, - - /** - * Set to render a preview of the parent post above this reply - */ - isFirstReply: PropTypes.bool, - - /** - * Set to highlight the background of the post - */ - highlight: PropTypes.bool, - - /** - * Set to render this post as if it was attached to the previous post - */ - consecutivePostByUser: PropTypes.bool, - - /** - * Set if the previous post is a comment - */ - previousPostIsComment: PropTypes.bool, - - /** - * Set to render this comment as a mention - */ - isCommentMention: PropTypes.bool, - - /** - * The number of replies in the same thread as this post - */ - replyCount: PropTypes.number, - - /** - * Set to mark the poster as in a webrtc call - */ - isBusy: PropTypes.bool, - - /** - * The post count used for selenium tests - */ - lastPostCount: PropTypes.number, - - /** - * Function to get the post list HTML element - */ - getPostList: PropTypes.func.isRequired - } - - constructor(props) { - super(props); - - this.state = { - dropdownOpened: false - }; - } - - handleCommentClick = (e) => { - e.preventDefault(); - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_POST_SELECTED, - postId: Utils.getRootId(this.props.post) - }); - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_SEARCH, - results: null - }); - } - - handleDropdownOpened = (opened) => { - this.setState({ - dropdownOpened: opened - }); - } - - forceUpdateInfo = () => { - this.refs.info.forceUpdate(); - this.refs.header.forceUpdate(); - } - - getClassName = (post, isSystemMessage, fromWebhook) => { - let className = 'post'; - - if (post.failed || post.state === Posts.POST_DELETED) { - className += ' post--hide-controls'; - } - - if (this.props.highlight) { - className += ' post--highlight'; - } - - let rootUser = ''; - if (this.props.isFirstReply) { - rootUser = 'other--root'; - } else if (!post.root_id && !this.props.previousPostIsComment && this.props.consecutivePostByUser) { - rootUser = 'same--root'; - } else if (post.root_id) { - rootUser = 'same--root'; - } else { - rootUser = 'other--root'; - } - - let currentUserCss = ''; - if (this.props.currentUser.id === post.user_id && !fromWebhook && !isSystemMessage) { - currentUserCss = 'current--user'; - } - - let sameUserClass = ''; - if (this.props.consecutivePostByUser) { - sameUserClass = 'same--user'; - } - - let postType = ''; - if (post.root_id && post.root_id.length > 0) { - postType = 'post--comment'; - } else if (this.props.replyCount > 0) { - postType = 'post--root'; - sameUserClass = ''; - rootUser = ''; - } - - if (isSystemMessage) { - className += ' post--system'; - sameUserClass = ''; - currentUserCss = ''; - postType = ''; - rootUser = ''; - } - - if (this.props.compactDisplay) { - className += ' post--compact'; - } - - if (this.state.dropdownOpened) { - className += ' post--hovered'; - } - - if (post.is_pinned) { - className += ' post--pinned'; - } - - return className + ' ' + sameUserClass + ' ' + rootUser + ' ' + postType + ' ' + currentUserCss; - } - - render() { - const post = this.props.post; - const mattermostLogo = Constants.MATTERMOST_ICON_SVG; - - const isSystemMessage = PostUtils.isSystemMessage(post); - const fromWebhook = post.props && post.props.from_webhook === 'true'; - - let status = this.props.status; - if (fromWebhook) { - status = null; - } - - let profilePic = ( - - ); - - if (fromWebhook) { - profilePic = ( - - ); - } else if (PostUtils.isSystemMessage(post)) { - profilePic = ( - - ); - } - - let centerClass = ''; - if (this.props.center) { - centerClass = 'center'; - } - - if (this.props.compactDisplay) { - if (fromWebhook) { - profilePic = ( - - ); - } else { - profilePic = ( - - ); - } - } - - const profilePicContainer = (
{profilePic}
); - - return ( -
{ - this.domNode = div; - }} - > -
-
- {profilePicContainer} -
- - -
-
-
-
- ); - } -} -- cgit v1.2.3-1-g7c22