summaryrefslogtreecommitdiffstats
path: root/web/react
diff options
context:
space:
mode:
Diffstat (limited to 'web/react')
-rw-r--r--web/react/components/post_info.jsx6
-rw-r--r--web/react/stores/post_store.jsx3
-rw-r--r--web/react/utils/constants.jsx2
-rw-r--r--web/react/utils/utils.jsx4
4 files changed, 9 insertions, 6 deletions
diff --git a/web/react/components/post_info.jsx b/web/react/components/post_info.jsx
index 02150bd9d..b1bc8ca14 100644
--- a/web/react/components/post_info.jsx
+++ b/web/react/components/post_info.jsx
@@ -30,7 +30,7 @@ export default class PostInfo extends React.Component {
var isOwner = UserStore.getCurrentId() === post.user_id;
var isAdmin = Utils.isAdmin(UserStore.getCurrentUser().roles);
- if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING || post.ephemeral) {
+ if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING || Utils.isPostEphemeral(post)) {
return '';
}
@@ -171,7 +171,7 @@ export default class PostInfo extends React.Component {
EventHelpers.emitRemovePost(this.props.post);
}
createRemovePostButton(post) {
- if (!post.ephemeral) {
+ if (!Utils.isPostEphemeral(post)) {
return null;
}
@@ -198,7 +198,7 @@ export default class PostInfo extends React.Component {
commentCountText = '';
}
- if (post.state !== Constants.POST_FAILED && post.state !== Constants.POST_LOADING && !post.ephemeral) {
+ if (post.state !== Constants.POST_FAILED && post.state !== Constants.POST_LOADING && !Utils.isPostEphemeral(post)) {
comments = (
<a
href='#'
diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx
index a504fef89..8ff58f685 100644
--- a/web/react/stores/post_store.jsx
+++ b/web/react/stores/post_store.jsx
@@ -342,8 +342,7 @@ class PostStoreClass extends EventEmitter {
// make sure to copy the post so that component state changes work properly
postList.posts[post.id] = Object.assign({}, post, {
state: Constants.POST_DELETED,
- filenames: [],
- ephemeral: true
+ filenames: []
});
}
}
diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx
index cfb33a79c..c1bd41b88 100644
--- a/web/react/utils/constants.jsx
+++ b/web/react/utils/constants.jsx
@@ -128,8 +128,8 @@ export default {
POST_LOADING: 'loading',
POST_FAILED: 'failed',
POST_DELETED: 'deleted',
- POST_TYPE_JOIN_LEAVE: 'system_join_leave',
POST_TYPE_EPHEMERAL: 'system_ephemeral',
+ POST_TYPE_JOIN_LEAVE: 'system_join_leave',
SYSTEM_MESSAGE_PREFIX: 'system_',
SYSTEM_MESSAGE_PROFILE_NAME: 'System',
SYSTEM_MESSAGE_PROFILE_IMAGE: '/static/images/logo_compact.png',
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 494c38bdb..e8cfc82bc 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -1355,3 +1355,7 @@ export function languages() {
]
);
}
+
+export function isPostEphemeral(post) {
+ return post.type === Constants.POST_TYPE_EPHEMERAL || post.state === Constants.POST_DELETED;
+}