From 7fdd41697e2ee975196930de71569f2bdbbd999e Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 17 Jul 2020 15:25:52 -0400 Subject: [PATCH] Un-expand image when receiving new post. Fixes #979 (#988) --- ui/src/components/post-listing.tsx | 3 +++ ui/src/utils.ts | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx index 418fe7b48..a47aba992 100644 --- a/ui/src/components/post-listing.tsx +++ b/ui/src/components/post-listing.tsx @@ -101,6 +101,9 @@ export class PostListing extends Component { this.state.upvotes = nextProps.post.upvotes; this.state.downvotes = nextProps.post.downvotes; this.state.score = nextProps.post.score; + if (this.props.post.id !== nextProps.post.id) { + this.state.imageExpanded = false; + } this.setState(this.state); } diff --git a/ui/src/utils.ts b/ui/src/utils.ts index 2bede7770..960477650 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -825,6 +825,11 @@ export function editPostRes(data: PostResponse, post: Post) { post.url = data.post.url; post.name = data.post.name; post.nsfw = data.post.nsfw; + post.deleted = data.post.deleted; + post.removed = data.post.removed; + post.stickied = data.post.stickied; + post.body = data.post.body; + post.locked = data.post.locked; } }