summaryrefslogtreecommitdiffstats
path: root/ui/src/components/post.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-01-30 21:15:58 -0500
committerDessalines <tyhou13@gmx.com>2020-01-30 21:15:58 -0500
commit5188bddd4ddb1d4f4bc4add24db210789054c2a5 (patch)
treef68f8cebb4189acb591bbd129fa052b1d09619d6 /ui/src/components/post.tsx
parent65adb0d15dcb10382dadca2694ee17b206c384fd (diff)
parent8cbdba1da39c15d2a3d13919398fc4d4c8ef2c6c (diff)
Merge branch 'dev' into websocket_scopes
Diffstat (limited to 'ui/src/components/post.tsx')
-rw-r--r--ui/src/components/post.tsx25
1 files changed, 24 insertions, 1 deletions
diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index f57d8913..36621248 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -23,6 +23,7 @@ import {
SearchType,
SortType,
SearchForm,
+ GetPostForm,
SearchResponse,
GetSiteResponse,
GetCommunityResponse,
@@ -84,7 +85,10 @@ export class Post extends Component<any, PostState> {
() => console.log('complete')
);
- WebSocketService.Instance.getPost(postId);
+ let form: GetPostForm = {
+ id: postId,
+ };
+ WebSocketService.Instance.getPost(form);
}
componentWillUnmount() {
@@ -231,6 +235,18 @@ export class Post extends Component<any, PostState> {
onChange={linkEvent(this, this.handleCommentSortChange)}
/>
</label>
+ <label
+ className={`btn btn-sm btn-secondary pointer ${this.state
+ .commentSort === CommentSortType.Old && 'active'}`}
+ >
+ {i18n.t('old')}
+ <input
+ type="radio"
+ value={CommentSortType.Old}
+ checked={this.state.commentSort === CommentSortType.Old}
+ onChange={linkEvent(this, this.handleCommentSortChange)}
+ />
+ </label>
</div>
);
}
@@ -313,6 +329,13 @@ export class Post extends Component<any, PostState> {
+a.comment.deleted - +b.comment.deleted ||
b.comment.published.localeCompare(a.comment.published)
);
+ } else if (this.state.commentSort == CommentSortType.Old) {
+ tree.sort(
+ (a, b) =>
+ +a.comment.removed - +b.comment.removed ||
+ +a.comment.deleted - +b.comment.deleted ||
+ a.comment.published.localeCompare(b.comment.published)
+ );
} else if (this.state.commentSort == CommentSortType.Hot) {
tree.sort(
(a, b) =>