summaryrefslogtreecommitdiffstats
path: root/webapp/components/post_view
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-07-25 21:10:39 +0200
committerChristopher Speller <crspeller@gmail.com>2017-07-25 12:10:39 -0700
commit5840905c7ff4cd37c54a0bbebddaeb2969c120cb (patch)
tree04bdebc26dbbf0e3bb8680e07a8c50c9dd4bc08f /webapp/components/post_view
parentb92d0b002438acedd13fc663042c39d1b6a14e3c (diff)
downloadchat-5840905c7ff4cd37c54a0bbebddaeb2969c120cb.tar.gz
chat-5840905c7ff4cd37c54a0bbebddaeb2969c120cb.tar.bz2
chat-5840905c7ff4cd37c54a0bbebddaeb2969c120cb.zip
[PLT-6744] Add "Only visible to you" note for ephemeral messages (#6790)
Diffstat (limited to 'webapp/components/post_view')
-rw-r--r--webapp/components/post_view/post_body/post_body.jsx1
-rw-r--r--webapp/components/post_view/post_info/post_info.jsx18
-rw-r--r--webapp/components/post_view/post_message_view/post_message_view.jsx15
3 files changed, 32 insertions, 2 deletions
diff --git a/webapp/components/post_view/post_body/post_body.jsx b/webapp/components/post_view/post_body/post_body.jsx
index 4c0e00c47..2f8f86d82 100644
--- a/webapp/components/post_view/post_body/post_body.jsx
+++ b/webapp/components/post_view/post_body/post_body.jsx
@@ -162,6 +162,7 @@ export default class PostBody extends React.PureComponent {
<PostMessageView
lastPostCount={this.props.lastPostCount}
post={this.props.post}
+ compactDisplay={this.props.compactDisplay}
/>
</div>
);
diff --git a/webapp/components/post_view/post_info/post_info.jsx b/webapp/components/post_view/post_info/post_info.jsx
index 6eaef0e0b..71f73b631 100644
--- a/webapp/components/post_view/post_info/post_info.jsx
+++ b/webapp/components/post_view/post_info/post_info.jsx
@@ -55,6 +55,11 @@ export default class PostInfo extends React.PureComponent {
lastPostCount: PropTypes.number,
/**
+ * Set to render in compact view
+ */
+ compactDisplay: PropTypes.bool,
+
+ /**
* Function to get the post list HTML element
*/
getPostList: PropTypes.func.isRequired,
@@ -208,6 +213,18 @@ export default class PostInfo extends React.PureComponent {
}
}
+ let visibleMessage;
+ if (isEphemeral && !this.props.compactDisplay) {
+ visibleMessage = (
+ <span className='post__visibility'>
+ <FormattedMessage
+ id='post_info.message.visible'
+ defaultMessage='(Only visible to you)'
+ />
+ </span>
+ );
+ }
+
let pinnedBadge;
if (post.is_pinned) {
pinnedBadge = (
@@ -237,6 +254,7 @@ export default class PostInfo extends React.PureComponent {
isFlagged={this.props.isFlagged}
isEphemeral={isEphemeral}
/>
+ {visibleMessage}
</div>
{options}
</div>
diff --git a/webapp/components/post_view/post_message_view/post_message_view.jsx b/webapp/components/post_view/post_message_view/post_message_view.jsx
index 76037741f..1c6035df9 100644
--- a/webapp/components/post_view/post_message_view/post_message_view.jsx
+++ b/webapp/components/post_view/post_message_view/post_message_view.jsx
@@ -61,7 +61,12 @@ export default class PostMessageView extends React.PureComponent {
/*
* Post identifiers for selenium tests
*/
- lastPostCount: PropTypes.number
+ lastPostCount: PropTypes.number,
+
+ /**
+ * Set to render post body compactly
+ */
+ compactDisplay: PropTypes.bool
};
static defaultProps = {
@@ -167,7 +172,13 @@ export default class PostMessageView extends React.PureComponent {
postId = Utils.createSafeId('lastPostMessageText' + this.props.lastPostCount);
}
- const htmlFormattedText = TextFormatting.formatText(this.props.post.message, options);
+ let message = this.props.post.message;
+ const isEphemeral = Utils.isPostEphemeral(this.props.post);
+ if (this.props.compactDisplay && isEphemeral) {
+ const visibleMessage = Utils.localizeMessage('post_info.message.visible.compact', ' (Only visible to you)');
+ message = message.concat(visibleMessage);
+ }
+ const htmlFormattedText = TextFormatting.formatText(message, options);
const postMessageComponent = this.postMessageHtmlToComponent(htmlFormattedText);
return (