summaryrefslogtreecommitdiffstats
path: root/ui/src/components/post.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-01-31 20:02:20 -0500
committerDessalines <tyhou13@gmx.com>2020-01-31 20:02:20 -0500
commit8036474ddad2f20c27a2fb023395306d6b9e577d (patch)
tree28f3546c9086931f33d9ee6d910c9aa43a5a1f77 /ui/src/components/post.tsx
parent5188bddd4ddb1d4f4bc4add24db210789054c2a5 (diff)
Starting to work on user message scope.
Diffstat (limited to 'ui/src/components/post.tsx')
-rw-r--r--ui/src/components/post.tsx11
1 files changed, 10 insertions, 1 deletions
diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index 36621248..99a20b46 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -47,6 +47,7 @@ interface PostState {
community: Community;
moderators: Array<CommunityUser>;
admins: Array<UserView>;
+ online: number;
scrolled?: boolean;
scrolled_comment_id?: number;
loading: boolean;
@@ -62,6 +63,7 @@ export class Post extends Component<any, PostState> {
community: null,
moderators: [],
admins: [],
+ online: null,
scrolled: false,
loading: true,
crossPosts: [],
@@ -280,6 +282,7 @@ export class Post extends Component<any, PostState> {
community={this.state.community}
moderators={this.state.moderators}
admins={this.state.admins}
+ online={this.state.online}
/>
</div>
);
@@ -378,6 +381,7 @@ export class Post extends Component<any, PostState> {
this.state.community = data.community;
this.state.moderators = data.moderators;
this.state.admins = data.admins;
+ this.state.online = data.online;
this.state.loading = false;
document.title = `${this.state.post.name} - ${WebSocketService.Instance.site.name}`;
@@ -432,10 +436,15 @@ export class Post extends Component<any, PostState> {
this.setState(this.state);
} else if (res.op == UserOperation.CreatePostLike) {
let data = res.data as CreatePostLikeResponse;
- this.state.post.my_vote = data.post.my_vote;
this.state.post.score = data.post.score;
this.state.post.upvotes = data.post.upvotes;
this.state.post.downvotes = data.post.downvotes;
+ if (data.post.my_vote !== null) {
+ this.state.post.my_vote = data.post.my_vote;
+ this.state.post.upvoteLoading = false;
+ this.state.post.downvoteLoading = false;
+ }
+
this.setState(this.state);
} else if (res.op == UserOperation.EditPost) {
let data = res.data as PostResponse;