From 88f398ffddbcbb58265d085c09cb72008be3f3d5 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Tue, 1 Aug 2017 20:16:45 +0800 Subject: Revert " #4755 Combining consecutive user join/leave system messages to single message and few other changes." (#7072) * Revert "PLT-6603: Don't return all posts on invalid query. (#7061)" This reverts commit 25a2013890c7e07b4621fa9b18342e7f35363049. * Revert " #4755 Combining consecutive user join/leave system messages to single message and few other changes. (#5945)" This reverts commit 8a91235fb3cdc8d094dbc2eaa0d7baa447132b3c. --- .../post_message_view/system_message_helpers.jsx | 51 ++++------------------ 1 file changed, 9 insertions(+), 42 deletions(-) (limited to 'webapp/components/post_view/post_message_view') diff --git a/webapp/components/post_view/post_message_view/system_message_helpers.jsx b/webapp/components/post_view/post_message_view/system_message_helpers.jsx index c215ddb59..c134e1a7a 100644 --- a/webapp/components/post_view/post_message_view/system_message_helpers.jsx +++ b/webapp/components/post_view/post_message_view/system_message_helpers.jsx @@ -7,13 +7,6 @@ import {FormattedMessage} from 'react-intl'; import {PostTypes} from 'utils/constants.jsx'; import {formatText} from 'utils/text_formatting.jsx'; -const joinLeaveMessageGetters = { - [PostTypes.JOIN_CHANNEL]: getJoinChannelMessage, - [PostTypes.LEAVE_CHANNEL]: getLeaveChannelMessage, - [PostTypes.ADD_TO_CHANNEL]: getAddToChannelMessage, - [PostTypes.REMOVE_FROM_CHANNEL]: getRemoveFromChannelMessage -}; - function renderUsername(value, options) { return renderFormattedText(value, {...options, markdown: false}); } @@ -22,60 +15,38 @@ function renderFormattedText(value, options) { return ; } -function renderJoinLeaveMessage(post, options, messageFunction) { - if (post.props.messages) { - return ( -
- {post.props.messages.map((message, key) => {joinLeaveMessageGetters[message.type](message, options)})} -
- ); - } - return messageFunction(post.props, options); -} - function renderJoinChannelMessage(post, options) { - return renderJoinLeaveMessage(post, options, getJoinChannelMessage); -} - -function getJoinChannelMessage(messageProps, options) { - const username = renderUsername(messageProps.username, options); + const username = renderUsername(post.props.username, options); return ( ); } function renderLeaveChannelMessage(post, options) { - return renderJoinLeaveMessage(post, options, getLeaveChannelMessage); -} - -function getLeaveChannelMessage(messageProps, options) { - const username = renderUsername(messageProps.username, options); + const username = renderUsername(post.props.username, options); return ( ); } function renderAddToChannelMessage(post, options) { - return renderJoinLeaveMessage(post, options, getAddToChannelMessage); -} + const username = renderUsername(post.props.username, options); + const addedUsername = renderUsername(post.props.addedUsername, options); -function getAddToChannelMessage(messageProps, options) { - const username = renderUsername(messageProps.username, options); - const addedUsername = renderUsername(messageProps.addedUsername, options); return (