Changed PostStore to not clear a deleted post's message
Этот коммит содержится в:
@@ -40,10 +40,6 @@ const holders = defineMessages({
|
|||||||
write: {
|
write: {
|
||||||
id: 'create_post.write',
|
id: 'create_post.write',
|
||||||
defaultMessage: 'Write a message...'
|
defaultMessage: 'Write a message...'
|
||||||
},
|
|
||||||
deleteMsg: {
|
|
||||||
id: 'create_post.deleteMsg',
|
|
||||||
defaultMessage: '(message deleted)'
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -70,7 +66,6 @@ class CreatePost extends React.Component {
|
|||||||
this.sendMessage = this.sendMessage.bind(this);
|
this.sendMessage = this.sendMessage.bind(this);
|
||||||
|
|
||||||
PostStore.clearDraftUploads();
|
PostStore.clearDraftUploads();
|
||||||
PostStore.deleteMessage(this.props.intl.formatMessage(holders.deleteMsg));
|
|
||||||
|
|
||||||
const draft = this.getCurrentDraft();
|
const draft = this.getCurrentDraft();
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ class PostBody extends React.Component {
|
|||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
links: linkData.links,
|
links: linkData.links,
|
||||||
message: linkData.text,
|
|
||||||
post: this.props.post,
|
post: this.props.post,
|
||||||
hasUserProfiles: profiles && Object.keys(profiles).length > 1
|
hasUserProfiles: profiles && Object.keys(profiles).length > 1
|
||||||
};
|
};
|
||||||
@@ -106,7 +105,9 @@ class PostBody extends React.Component {
|
|||||||
if (this.props.post.filenames.length === 0 && this.state.links && this.state.links.length > 0) {
|
if (this.props.post.filenames.length === 0 && this.state.links && this.state.links.length > 0) {
|
||||||
this.embed = this.createEmbed(linkData.links[0]);
|
this.embed = this.createEmbed(linkData.links[0]);
|
||||||
}
|
}
|
||||||
this.setState({links: linkData.links, message: linkData.text});
|
this.setState({
|
||||||
|
links: linkData.links
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
createEmbed(link) {
|
createEmbed(link) {
|
||||||
@@ -310,6 +311,23 @@ class PostBody extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let message;
|
||||||
|
if (this.props.post.state === Constants.POST_DELETED) {
|
||||||
|
message = (
|
||||||
|
<FormattedMessage
|
||||||
|
id='post_body.deleted'
|
||||||
|
defaultMessage='(message deleted)'
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
message = (
|
||||||
|
<span
|
||||||
|
onClick={TextFormatting.handleClick}
|
||||||
|
dangerouslySetInnerHTML={{__html: TextFormatting.formatText(this.props.post.message)}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{comment}
|
{comment}
|
||||||
@@ -320,11 +338,7 @@ class PostBody extends React.Component {
|
|||||||
className={postClass}
|
className={postClass}
|
||||||
>
|
>
|
||||||
{loading}
|
{loading}
|
||||||
<span
|
{message}
|
||||||
ref='message_span'
|
|
||||||
onClick={TextFormatting.handleClick}
|
|
||||||
dangerouslySetInnerHTML={{__html: TextFormatting.formatText(this.state.message)}}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<PostBodyAdditionalContent
|
<PostBodyAdditionalContent
|
||||||
post={this.state.post}
|
post={this.state.post}
|
||||||
|
|||||||
@@ -341,7 +341,6 @@ class PostStoreClass extends EventEmitter {
|
|||||||
if (post.id in postList.posts) {
|
if (post.id in postList.posts) {
|
||||||
// make sure to copy the post so that component state changes work properly
|
// make sure to copy the post so that component state changes work properly
|
||||||
postList.posts[post.id] = Object.assign({}, post, {
|
postList.posts[post.id] = Object.assign({}, post, {
|
||||||
message: this.delete_message, // TODO
|
|
||||||
state: Constants.POST_DELETED,
|
state: Constants.POST_DELETED,
|
||||||
filenames: [],
|
filenames: [],
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
@@ -534,9 +533,6 @@ class PostStoreClass extends EventEmitter {
|
|||||||
|
|
||||||
return commentCount;
|
return commentCount;
|
||||||
}
|
}
|
||||||
deleteMessage(msg) {
|
|
||||||
this.delete_message = msg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var PostStore = new PostStoreClass();
|
var PostStore = new PostStoreClass();
|
||||||
|
|||||||
@@ -562,7 +562,6 @@
|
|||||||
"create_post.comment": "Comment",
|
"create_post.comment": "Comment",
|
||||||
"create_post.post": "Post",
|
"create_post.post": "Post",
|
||||||
"create_post.write": "Write a message...",
|
"create_post.write": "Write a message...",
|
||||||
"create_post.deleteMsg": "(message deleted)",
|
|
||||||
"create_post.tutorialTip": "<h4>Sending Messages</h4><p>Type here to write a message and press <strong>Enter</strong> to post it.</p><p>Click the <strong>Attachment</strong> button to upload an image or a file.</p>",
|
"create_post.tutorialTip": "<h4>Sending Messages</h4><p>Type here to write a message and press <strong>Enter</strong> to post it.</p><p>Click the <strong>Attachment</strong> button to upload an image or a file.</p>",
|
||||||
"delete_channel.channel": "channel",
|
"delete_channel.channel": "channel",
|
||||||
"delete_channel.group": "group",
|
"delete_channel.group": "group",
|
||||||
@@ -768,6 +767,7 @@
|
|||||||
"members_popover.title": "Members",
|
"members_popover.title": "Members",
|
||||||
"post_attachment.collapse": "▲ collapse text",
|
"post_attachment.collapse": "▲ collapse text",
|
||||||
"post_attachment.more": "▼ read more",
|
"post_attachment.more": "▼ read more",
|
||||||
|
"post_body.deleted": "(message deleted)",
|
||||||
"post_body.plusOne": " plus 1 other file",
|
"post_body.plusOne": " plus 1 other file",
|
||||||
"post_body.plusMore": " plus {count} other files",
|
"post_body.plusMore": " plus {count} other files",
|
||||||
"post_body.commentedOn": "Commented on {name}{apostrophe} message: ",
|
"post_body.commentedOn": "Commented on {name}{apostrophe} message: ",
|
||||||
|
|||||||
@@ -589,7 +589,6 @@
|
|||||||
"create_comment.file": "Subiendo archivo",
|
"create_comment.file": "Subiendo archivo",
|
||||||
"create_comment.files": "Subiendo archivos",
|
"create_comment.files": "Subiendo archivos",
|
||||||
"create_post.comment": "Comentario",
|
"create_post.comment": "Comentario",
|
||||||
"create_post.deleteMsg": "(mensaje eliminado)",
|
|
||||||
"create_post.post": "Mensaje",
|
"create_post.post": "Mensaje",
|
||||||
"create_post.tutorialTip": "<h4>Enviar Mensajes</h4> <p>Escribe aquí para redactar un mensaje y presiona <strong>Retorno</strong> para enviarlo.</p><p>Pincha el botón de <strong>Adjuntar</strong> para subir una imagen o archivo.</p>",
|
"create_post.tutorialTip": "<h4>Enviar Mensajes</h4> <p>Escribe aquí para redactar un mensaje y presiona <strong>Retorno</strong> para enviarlo.</p><p>Pincha el botón de <strong>Adjuntar</strong> para subir una imagen o archivo.</p>",
|
||||||
"create_post.write": "Escribe un mensaje...",
|
"create_post.write": "Escribe un mensaje...",
|
||||||
@@ -809,6 +808,7 @@
|
|||||||
"post_attachment.collapse": "▲ colapsar texto",
|
"post_attachment.collapse": "▲ colapsar texto",
|
||||||
"post_attachment.more": "▼ leer más",
|
"post_attachment.more": "▼ leer más",
|
||||||
"post_body.commentedOn": "Comentó el mensaje de {name}{apostrophe}: ",
|
"post_body.commentedOn": "Comentó el mensaje de {name}{apostrophe}: ",
|
||||||
|
"post_body.deleted": "(mensaje eliminado)",
|
||||||
"post_body.plusMore": " más {count} otros archivos",
|
"post_body.plusMore": " más {count} otros archivos",
|
||||||
"post_body.plusOne": " más 1 archivo",
|
"post_body.plusOne": " más 1 archivo",
|
||||||
"post_body.retry": "Reintentar",
|
"post_body.retry": "Reintentar",
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user