[PLT-6744] Add "Only visible to you" note for ephemeral messages (#6790)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
b92d0b0024
Коммит
5840905c7f
@@ -162,6 +162,7 @@ export default class PostBody extends React.PureComponent {
|
|||||||
<PostMessageView
|
<PostMessageView
|
||||||
lastPostCount={this.props.lastPostCount}
|
lastPostCount={this.props.lastPostCount}
|
||||||
post={this.props.post}
|
post={this.props.post}
|
||||||
|
compactDisplay={this.props.compactDisplay}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -54,6 +54,11 @@ export default class PostInfo extends React.PureComponent {
|
|||||||
*/
|
*/
|
||||||
lastPostCount: PropTypes.number,
|
lastPostCount: PropTypes.number,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to render in compact view
|
||||||
|
*/
|
||||||
|
compactDisplay: PropTypes.bool,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to get the post list HTML element
|
* Function to get the post list HTML element
|
||||||
*/
|
*/
|
||||||
@@ -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;
|
let pinnedBadge;
|
||||||
if (post.is_pinned) {
|
if (post.is_pinned) {
|
||||||
pinnedBadge = (
|
pinnedBadge = (
|
||||||
@@ -237,6 +254,7 @@ export default class PostInfo extends React.PureComponent {
|
|||||||
isFlagged={this.props.isFlagged}
|
isFlagged={this.props.isFlagged}
|
||||||
isEphemeral={isEphemeral}
|
isEphemeral={isEphemeral}
|
||||||
/>
|
/>
|
||||||
|
{visibleMessage}
|
||||||
</div>
|
</div>
|
||||||
{options}
|
{options}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -61,7 +61,12 @@ export default class PostMessageView extends React.PureComponent {
|
|||||||
/*
|
/*
|
||||||
* Post identifiers for selenium tests
|
* Post identifiers for selenium tests
|
||||||
*/
|
*/
|
||||||
lastPostCount: PropTypes.number
|
lastPostCount: PropTypes.number,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to render post body compactly
|
||||||
|
*/
|
||||||
|
compactDisplay: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
@@ -167,7 +172,13 @@ export default class PostMessageView extends React.PureComponent {
|
|||||||
postId = Utils.createSafeId('lastPostMessageText' + this.props.lastPostCount);
|
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);
|
const postMessageComponent = this.postMessageHtmlToComponent(htmlFormattedText);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ export default class RhsComment extends React.Component {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let visibleMessage;
|
||||||
if (post.props && post.props.from_webhook) {
|
if (post.props && post.props.from_webhook) {
|
||||||
if (post.props.override_username && global.window.mm_config.EnablePostUsernameOverride === 'true') {
|
if (post.props.override_username && global.window.mm_config.EnablePostUsernameOverride === 'true') {
|
||||||
userProfile = (
|
userProfile = (
|
||||||
@@ -259,6 +260,15 @@ export default class RhsComment extends React.Component {
|
|||||||
disablePopover={true}
|
disablePopover={true}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
visibleMessage = (
|
||||||
|
<span className='post__visibility'>
|
||||||
|
<FormattedMessage
|
||||||
|
id='post_info.message.visible'
|
||||||
|
defaultMessage='(Only visible to you)'
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let failedPostOptions;
|
let failedPostOptions;
|
||||||
@@ -430,6 +440,7 @@ export default class RhsComment extends React.Component {
|
|||||||
isFlagged={this.props.isFlagged}
|
isFlagged={this.props.isFlagged}
|
||||||
isEphemeral={isEphemeral}
|
isEphemeral={isEphemeral}
|
||||||
/>
|
/>
|
||||||
|
{visibleMessage}
|
||||||
</div>
|
</div>
|
||||||
{options}
|
{options}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1903,6 +1903,8 @@
|
|||||||
"post_delete.okay": "Okay",
|
"post_delete.okay": "Okay",
|
||||||
"post_delete.someone": "Someone deleted the message on which you tried to post a comment.",
|
"post_delete.someone": "Someone deleted the message on which you tried to post a comment.",
|
||||||
"post_focus_view.beginning": "Beginning of Channel Archives",
|
"post_focus_view.beginning": "Beginning of Channel Archives",
|
||||||
|
"post_info.message.visible": "(Only visible to you)",
|
||||||
|
"post_info.message.visible.compact": " (Only visible to you)",
|
||||||
"post_info.del": "Delete",
|
"post_info.del": "Delete",
|
||||||
"post_info.edit": "Edit",
|
"post_info.edit": "Edit",
|
||||||
"post_info.mobile.flag": "Flag",
|
"post_info.mobile.flag": "Flag",
|
||||||
|
|||||||
@@ -1383,6 +1383,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post__visibility {
|
||||||
|
@include opacity(.6);
|
||||||
|
font-size: .9em;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.post__time {
|
.post__time {
|
||||||
@include opacity(.6);
|
@include opacity(.6);
|
||||||
font-size: .9em;
|
font-size: .9em;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user