]> Untitled Git - lemmy.git/commitdiff
Fix issue with post creating redirecting other posts. Fixes #520
authorDessalines <tyhou13@gmx.com>
Fri, 7 Feb 2020 15:12:05 +0000 (10:12 -0500)
committerDessalines <tyhou13@gmx.com>
Fri, 7 Feb 2020 15:12:05 +0000 (10:12 -0500)
ui/src/components/post-form.tsx

index 35d4e595618599230a81404b85d20d6d7fb216cf..7984c2a8512190bf7dce1abcf2aa0f08230aae5b 100644 (file)
@@ -516,12 +516,16 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
       this.setState(this.state);
     } else if (res.op == UserOperation.CreatePost) {
       let data = res.data as PostResponse;
-      this.state.loading = false;
-      this.props.onCreate(data.post.id);
+      if (data.post.creator_id == UserService.Instance.user.id) {
+        this.state.loading = false;
+        this.props.onCreate(data.post.id);
+      }
     } else if (res.op == UserOperation.EditPost) {
       let data = res.data as PostResponse;
-      this.state.loading = false;
-      this.props.onEdit(data.post);
+      if (data.post.creator_id == UserService.Instance.user.id) {
+        this.state.loading = false;
+        this.props.onEdit(data.post);
+      }
     } else if (res.op == UserOperation.Search) {
       let data = res.data as SearchResponse;