summaryrefslogtreecommitdiffstats
path: root/ui/src
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-02-02 12:45:41 -0500
committerDessalines <tyhou13@gmx.com>2020-02-02 12:45:41 -0500
commit96a7e99e57f8c79eead599e6de5d94016f7021e6 (patch)
tree3447364e73f461660c0db87cd2f45ddea16a50ee /ui/src
parentcda1e6e74141efea556e81082a3468a012d2926d (diff)
Removing PostLikeResponse in favor of PostResponse. Consolidating comment and post_sends.
Diffstat (limited to 'ui/src')
-rw-r--r--ui/src/components/community.tsx3
-rw-r--r--ui/src/components/main.tsx3
-rw-r--r--ui/src/components/post.tsx7
-rw-r--r--ui/src/components/search.tsx4
-rw-r--r--ui/src/interfaces.ts6
5 files changed, 8 insertions, 15 deletions
diff --git a/ui/src/components/community.tsx b/ui/src/components/community.tsx
index 866b9eec..18767c51 100644
--- a/ui/src/components/community.tsx
+++ b/ui/src/components/community.tsx
@@ -15,7 +15,6 @@ import {
ListingType,
GetPostsResponse,
PostResponse,
- CreatePostLikeResponse,
AddModToCommunityResponse,
BanFromCommunityResponse,
WebSocketJsonResponse,
@@ -294,7 +293,7 @@ export class Community extends Component<any, State> {
this.state.posts.unshift(data.post);
this.setState(this.state);
} else if (res.op == UserOperation.CreatePostLike) {
- let data = res.data as CreatePostLikeResponse;
+ let data = res.data as PostResponse;
let found = this.state.posts.find(c => c.id == data.post.id);
found.score = data.post.score;
diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx
index 9ff6af44..ec801f90 100644
--- a/ui/src/components/main.tsx
+++ b/ui/src/components/main.tsx
@@ -14,7 +14,6 @@ import {
ListingType,
SiteResponse,
GetPostsResponse,
- CreatePostLikeResponse,
PostResponse,
Post,
GetPostsForm,
@@ -622,7 +621,7 @@ export class Main extends Component<any, MainState> {
this.setState(this.state);
} else if (res.op == UserOperation.CreatePostLike) {
- let data = res.data as CreatePostLikeResponse;
+ let data = res.data as PostResponse;
let found = this.state.posts.find(c => c.id == data.post.id);
found.score = data.post.score;
diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index fcf79438..b53d7d4f 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -11,7 +11,6 @@ import {
CommentForm as CommentFormI,
CommentResponse,
CommentSortType,
- CreatePostLikeResponse,
CommunityUser,
CommunityResponse,
CommentNode as CommentNodeI,
@@ -401,8 +400,8 @@ export class Post extends Component<any, PostState> {
} else if (res.op == UserOperation.CreateComment) {
let data = res.data as CommentResponse;
- // Necessary since a user might receive a comment reply on another thread
- if (data.comment.post_id == this.state.post.id) {
+ // Necessary since it might be a user reply
+ if (data.recipient_ids.length == 0) {
this.state.comments.unshift(data.comment);
this.setState(this.state);
}
@@ -439,7 +438,7 @@ export class Post extends Component<any, PostState> {
}
this.setState(this.state);
} else if (res.op == UserOperation.CreatePostLike) {
- let data = res.data as CreatePostLikeResponse;
+ let data = res.data as PostResponse;
this.state.post.score = data.post.score;
this.state.post.upvotes = data.post.upvotes;
this.state.post.downvotes = data.post.downvotes;
diff --git a/ui/src/components/search.tsx b/ui/src/components/search.tsx
index 604c2617..f376f609 100644
--- a/ui/src/components/search.tsx
+++ b/ui/src/components/search.tsx
@@ -12,7 +12,7 @@ import {
SearchForm,
SearchResponse,
SearchType,
- CreatePostLikeResponse,
+ PostResponse,
CommentResponse,
WebSocketJsonResponse,
} from '../interfaces';
@@ -506,7 +506,7 @@ export class Search extends Component<any, SearchState> {
}
this.setState(this.state);
} else if (res.op == UserOperation.CreatePostLike) {
- let data = res.data as CreatePostLikeResponse;
+ let data = res.data as PostResponse;
let found = this.state.searchResponse.posts.find(
c => c.id == data.post.id
);
diff --git a/ui/src/interfaces.ts b/ui/src/interfaces.ts
index 4036f7e6..98cdc763 100644
--- a/ui/src/interfaces.ts
+++ b/ui/src/interfaces.ts
@@ -664,10 +664,6 @@ export interface CreatePostLikeForm {
auth?: string;
}
-export interface CreatePostLikeResponse {
- post: Post;
-}
-
export interface SiteForm {
name: string;
description?: string;
@@ -831,7 +827,7 @@ type ResponseType =
| GetFollowedCommunitiesResponse
| ListCommunitiesResponse
| GetPostsResponse
- | CreatePostLikeResponse
+ | PostResponse
| GetRepliesResponse
| GetUserMentionsResponse
| ListCategoriesResponse