Simplify cross-posts. Fixes #727
This commit is contained in:
parent
f5e96d9372
commit
99e4551cf6
1 changed files with 13 additions and 17 deletions
30
ui/src/components/post.tsx
vendored
30
ui/src/components/post.tsx
vendored
|
@ -40,7 +40,6 @@ import {
|
||||||
setupTippy,
|
setupTippy,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
import { PostListing } from './post-listing';
|
import { PostListing } from './post-listing';
|
||||||
import { PostListings } from './post-listings';
|
|
||||||
import { Sidebar } from './sidebar';
|
import { Sidebar } from './sidebar';
|
||||||
import { CommentForm } from './comment-form';
|
import { CommentForm } from './comment-form';
|
||||||
import { CommentNodes } from './comment-nodes';
|
import { CommentNodes } from './comment-nodes';
|
||||||
|
@ -183,14 +182,6 @@ export class Post extends Component<any, PostState> {
|
||||||
moderators={this.state.moderators}
|
moderators={this.state.moderators}
|
||||||
admins={this.state.admins}
|
admins={this.state.admins}
|
||||||
/>
|
/>
|
||||||
{this.state.crossPosts.length > 0 && (
|
|
||||||
<>
|
|
||||||
<div class="my-1 text-muted small font-weight-bold">
|
|
||||||
{i18n.t('cross_posts')}
|
|
||||||
</div>
|
|
||||||
<PostListings showCommunity posts={this.state.crossPosts} />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<div className="mb-2" />
|
<div className="mb-2" />
|
||||||
<CommentForm
|
<CommentForm
|
||||||
postId={this.state.post.id}
|
postId={this.state.post.id}
|
||||||
|
@ -213,8 +204,9 @@ export class Post extends Component<any, PostState> {
|
||||||
return (
|
return (
|
||||||
<div class="btn-group btn-group-toggle mb-2">
|
<div class="btn-group btn-group-toggle mb-2">
|
||||||
<label
|
<label
|
||||||
className={`btn btn-sm btn-secondary pointer ${this.state
|
className={`btn btn-sm btn-secondary pointer ${
|
||||||
.commentSort === CommentSortType.Hot && 'active'}`}
|
this.state.commentSort === CommentSortType.Hot && 'active'
|
||||||
|
}`}
|
||||||
>
|
>
|
||||||
{i18n.t('hot')}
|
{i18n.t('hot')}
|
||||||
<input
|
<input
|
||||||
|
@ -225,8 +217,9 @@ export class Post extends Component<any, PostState> {
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label
|
<label
|
||||||
className={`btn btn-sm btn-secondary pointer ${this.state
|
className={`btn btn-sm btn-secondary pointer ${
|
||||||
.commentSort === CommentSortType.Top && 'active'}`}
|
this.state.commentSort === CommentSortType.Top && 'active'
|
||||||
|
}`}
|
||||||
>
|
>
|
||||||
{i18n.t('top')}
|
{i18n.t('top')}
|
||||||
<input
|
<input
|
||||||
|
@ -237,8 +230,9 @@ export class Post extends Component<any, PostState> {
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label
|
<label
|
||||||
className={`btn btn-sm btn-secondary pointer ${this.state
|
className={`btn btn-sm btn-secondary pointer ${
|
||||||
.commentSort === CommentSortType.New && 'active'}`}
|
this.state.commentSort === CommentSortType.New && 'active'
|
||||||
|
}`}
|
||||||
>
|
>
|
||||||
{i18n.t('new')}
|
{i18n.t('new')}
|
||||||
<input
|
<input
|
||||||
|
@ -249,8 +243,9 @@ export class Post extends Component<any, PostState> {
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label
|
<label
|
||||||
className={`btn btn-sm btn-secondary pointer ${this.state
|
className={`btn btn-sm btn-secondary pointer ${
|
||||||
.commentSort === CommentSortType.Old && 'active'}`}
|
this.state.commentSort === CommentSortType.Old && 'active'
|
||||||
|
}`}
|
||||||
>
|
>
|
||||||
{i18n.t('old')}
|
{i18n.t('old')}
|
||||||
<input
|
<input
|
||||||
|
@ -462,6 +457,7 @@ export class Post extends Component<any, PostState> {
|
||||||
this.state.crossPosts = data.posts.filter(
|
this.state.crossPosts = data.posts.filter(
|
||||||
p => p.id != Number(this.props.match.params.id)
|
p => p.id != Number(this.props.match.params.id)
|
||||||
);
|
);
|
||||||
|
this.state.post.duplicates = this.state.crossPosts;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
} else if (res.op == UserOperation.TransferSite) {
|
} else if (res.op == UserOperation.TransferSite) {
|
||||||
let data = res.data as GetSiteResponse;
|
let data = res.data as GetSiteResponse;
|
||||||
|
|
Reference in a new issue