|
|
@ -119,7 +119,6 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|
|
|
<div class="listing col-12">
|
|
|
|
<div class="listing col-12">
|
|
|
|
<div className={`vote-bar mr-2 float-left small text-center`}>
|
|
|
|
<div className={`vote-bar mr-2 float-left small text-center`}>
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
disabled={!UserService.Instance.user}
|
|
|
|
|
|
|
|
className={`btn p-0 ${
|
|
|
|
className={`btn p-0 ${
|
|
|
|
post.my_vote == 1 ? 'text-info' : 'text-muted'
|
|
|
|
post.my_vote == 1 ? 'text-info' : 'text-muted'
|
|
|
|
}`}
|
|
|
|
}`}
|
|
|
@ -138,7 +137,6 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|
|
|
<div class={`font-weight-bold text-muted`}>{post.score}</div>
|
|
|
|
<div class={`font-weight-bold text-muted`}>{post.score}</div>
|
|
|
|
{WebSocketService.Instance.site.enable_downvotes && (
|
|
|
|
{WebSocketService.Instance.site.enable_downvotes && (
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
disabled={!UserService.Instance.user}
|
|
|
|
|
|
|
|
className={`btn p-0 ${
|
|
|
|
className={`btn p-0 ${
|
|
|
|
post.my_vote == -1 ? 'text-danger' : 'text-muted'
|
|
|
|
post.my_vote == -1 ? 'text-danger' : 'text-muted'
|
|
|
|
}`}
|
|
|
|
}`}
|
|
|
@ -740,17 +738,22 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handlePostLike(i: PostListing) {
|
|
|
|
handlePostLike(i: PostListing) {
|
|
|
|
|
|
|
|
if (UserService.Instance.user) {
|
|
|
|
i.setState({ upvoteLoading: true });
|
|
|
|
i.setState({ upvoteLoading: true });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let form: CreatePostLikeForm = {
|
|
|
|
let form: CreatePostLikeForm = {
|
|
|
|
post_id: i.props.post.id,
|
|
|
|
post_id: i.props.post.id,
|
|
|
|
score: i.props.post.my_vote == 1 ? 0 : 1,
|
|
|
|
score: i.props.post.my_vote == 1 ? 0 : 1,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
WebSocketService.Instance.likePost(form);
|
|
|
|
WebSocketService.Instance.likePost(form);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handlePostDisLike(i: PostListing) {
|
|
|
|
handlePostDisLike(i: PostListing) {
|
|
|
|
|
|
|
|
if (UserService.Instance.user) {
|
|
|
|
i.setState({ downvoteLoading: true });
|
|
|
|
i.setState({ downvoteLoading: true });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let form: CreatePostLikeForm = {
|
|
|
|
let form: CreatePostLikeForm = {
|
|
|
|
post_id: i.props.post.id,
|
|
|
|
post_id: i.props.post.id,
|
|
|
|