summaryrefslogtreecommitdiffstats
path: root/webapp/stores
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-05-31 23:55:53 +0800
committerHarrison Healey <harrisonmhealey@gmail.com>2017-05-31 11:55:53 -0400
commit8ce72aedc3a5b4f783fb6ebab38aac8bf5f413ae (patch)
treef0c2e3b124c289ef43776631b89456e556b8149c /webapp/stores
parentfdf1164aee36d60b34ca82c07fe02b68e972f53a (diff)
downloadchat-8ce72aedc3a5b4f783fb6ebab38aac8bf5f413ae.tar.gz
chat-8ce72aedc3a5b4f783fb6ebab38aac8bf5f413ae.tar.bz2
chat-8ce72aedc3a5b4f783fb6ebab38aac8bf5f413ae.zip
fix JS error when adding reaction when latest post is ephemeral (#6512)
Diffstat (limited to 'webapp/stores')
-rw-r--r--webapp/stores/post_store.jsx14
1 files changed, 14 insertions, 0 deletions
diff --git a/webapp/stores/post_store.jsx b/webapp/stores/post_store.jsx
index 770e232ca..a402490af 100644
--- a/webapp/stores/post_store.jsx
+++ b/webapp/stores/post_store.jsx
@@ -148,6 +148,20 @@ class PostStoreClass extends EventEmitter {
return null;
}
+ getLatestNonEphemeralPost(id) {
+ if (this.postsInfo.hasOwnProperty(id)) {
+ const postList = this.postsInfo[id].postList;
+
+ for (const postId of postList.order) {
+ if (postList.posts[postId].state !== Constants.POST_DELETED && postList.posts[postId].type !== Constants.PostTypes.EPHEMERAL) {
+ return postList.posts[postId];
+ }
+ }
+ }
+
+ return null;
+ }
+
getLatestPostFromPageTime(id) {
if (this.latestPageTime.hasOwnProperty(id)) {
return this.latestPageTime[id];