summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-08-01 20:16:45 +0800
committerJoram Wilander <jwawilander@gmail.com>2017-08-01 08:16:45 -0400
commit88f398ffddbcbb58265d085c09cb72008be3f3d5 (patch)
tree6db22e220a781a144808e113505ce040c7e2eac7 /webapp
parentb023b891550cd8fb2f874e822f05921d13f51fb2 (diff)
downloadchat-88f398ffddbcbb58265d085c09cb72008be3f3d5.tar.gz
chat-88f398ffddbcbb58265d085c09cb72008be3f3d5.tar.bz2
chat-88f398ffddbcbb58265d085c09cb72008be3f3d5.zip
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.
Diffstat (limited to 'webapp')
-rw-r--r--webapp/components/post_view/post_message_view/system_message_helpers.jsx51
-rwxr-xr-xwebapp/i18n/en.json8
2 files changed, 13 insertions, 46 deletions
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 <span dangerouslySetInnerHTML={{__html: formatText(value, options)}}/>;
}
-function renderJoinLeaveMessage(post, options, messageFunction) {
- if (post.props.messages) {
- return (
- <div>
- {post.props.messages.map((message, key) => <span key={key}> {joinLeaveMessageGetters[message.type](message, options)}</span>)}
- </div>
- );
- }
- 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 (
<FormattedMessage
id='api.channel.join_channel.post_and_forget'
- defaultMessage='{username} joined the channel.'
+ defaultMessage='{username} has joined the channel.'
values={{username}}
/>
);
}
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 (
<FormattedMessage
id='api.channel.leave.left'
- defaultMessage='{username} left the channel.'
+ defaultMessage='{username} has left the channel.'
values={{username}}
/>
);
}
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 (
<FormattedMessage
id='api.channel.add_member.added'
- defaultMessage='{username} added {addedUsername} to the channel.'
+ defaultMessage='{addedUsername} added to the channel by {username}'
values={{
username,
addedUsername
@@ -85,16 +56,12 @@ function getAddToChannelMessage(messageProps, options) {
}
function renderRemoveFromChannelMessage(post, options) {
- return renderJoinLeaveMessage(post, options, getRemoveFromChannelMessage);
-}
-
-function getRemoveFromChannelMessage(messageProps, options) {
- const removedUsername = renderUsername(messageProps.removedUsername, options);
+ const removedUsername = renderUsername(post.props.removedUsername, options);
return (
<FormattedMessage
id='api.channel.remove_member.removed'
- defaultMessage='{removedUsername} was removed from the channel.'
+ defaultMessage='{removedUsername} was removed from the channel'
values={{
removedUsername
}}
diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json
index 55fc3cd74..79d291e47 100755
--- a/webapp/i18n/en.json
+++ b/webapp/i18n/en.json
@@ -1042,15 +1042,15 @@
"analytics.team.title": "Team Statistics for {team}",
"analytics.team.totalPosts": "Total Posts",
"analytics.team.totalUsers": "Total Users",
- "api.channel.add_member.added": " {username} added {addedUsername} to the channel.",
+ "api.channel.add_member.added": "{addedUsername} added to the channel by {username}",
"api.channel.delete_channel.archived": "{username} has archived the channel.",
- "api.channel.join_channel.post_and_forget": "{username} joined the channel.",
- "api.channel.leave.left": "{username} left the channel.",
+ "api.channel.join_channel.post_and_forget": "{username} has joined the channel.",
+ "api.channel.leave.left": "{username} has left the channel.",
"api.channel.post_update_channel_displayname_message_and_forget.updated_from": "{username} updated the channel display name from: {old} to: {new}",
"api.channel.post_update_channel_header_message_and_forget.removed": "{username} removed the channel header (was: {old})",
"api.channel.post_update_channel_header_message_and_forget.updated_from": "{username} updated the channel header from: {old} to: {new}",
"api.channel.post_update_channel_header_message_and_forget.updated_to": "{username} updated the channel header to: {new}",
- "api.channel.remove_member.removed": "{removedUsername} was removed from the channel.",
+ "api.channel.remove_member.removed": "{removedUsername} was removed from the channel",
"app.channel.post_update_channel_purpose_message.removed": "{username} removed the channel purpose (was: {old})",
"app.channel.post_update_channel_purpose_message.updated_from": "{username} updated the channel purpose from: {old} to: {new}",
"app.channel.post_update_channel_purpose_message.updated_to": "{username} updated the channel purpose to: {new}",