Browse Source

Merge pull request 'post: validate post id before updating' (#84) from fix/edit-post-ws into main

Reviewed-on: https://git.chapo.chat/chapo-collective/hexbear-frontend/pulls/84
main
DashEightMate 9 months ago
parent
commit
2d72f65d86
  1. 16
      src/components/post.tsx

16
src/components/post.tsx

@ -606,14 +606,18 @@ export class Post extends Component<any, PostState> {
this.setState(this.state);
} else if (isPostChanged(res.op)) {
let data = res.data as PostResponse;
this.state.post = data.post;
this.setState(this.state);
setupTippy();
if (this.state.post.id === data.post.id) {
this.state.post = data.post;
this.setState(this.state);
setupTippy();
}
} else if (res.op == UserOperation.SavePost) {
let data = res.data as PostResponse;
this.state.post = data.post;
this.setState(this.state);
setupTippy();
if (this.state.post.id === data.post.id) {
this.state.post = data.post;
this.setState(this.state);
setupTippy();
}
} else if (res.op == UserOperation.EditCommunity) {
let data = res.data as CommunityResponse;
this.state.community = data.community;

Loading…
Cancel
Save