From d923cfa522c19ff7b533e64d4e00438196000246 Mon Sep 17 00:00:00 2001 From: Pavlos Smith <57727226+iByteABit256@users.noreply.github.com> Date: Fri, 4 Aug 2023 23:32:07 +0300 Subject: [PATCH 1/3] Lemmy 2515 controversial posts and comments (#1727) * Added buttons to be able to sort posts and comments by controversy rank * Added buttons to be able to sort posts and comments by controversy rank * lost changes * Hiding controversial sort if downvotes disabled (unfinished) * Finished hiding sort option correctly * Removed newline * Removed hiding logic for now, this should be included in a future PR * woodpecker re-run * woodpecker re-run * woodpecker re-run * Update lemmy js-client version --------- Co-authored-by: Dessalines Co-authored-by: SleeplessOne1917 --- package.json | 2 +- .../components/common/comment-sort-select.tsx | 3 +++ src/shared/components/common/sort-select.tsx | 3 +++ src/shared/components/post/post.tsx | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 27b9cb4f..8e3694b9 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "inferno-router": "^8.2.2", "inferno-server": "^8.2.2", "jwt-decode": "^3.1.2", - "lemmy-js-client": "0.18.1", + "lemmy-js-client": "0.19.0-rc.1", "lodash.isequal": "^4.5.0", "markdown-it": "^13.0.1", "markdown-it-container": "^3.0.0", diff --git a/src/shared/components/common/comment-sort-select.tsx b/src/shared/components/common/comment-sort-select.tsx index ad4eebfe..f9115583 100644 --- a/src/shared/components/common/comment-sort-select.tsx +++ b/src/shared/components/common/comment-sort-select.tsx @@ -48,6 +48,9 @@ export class CommentSortSelect extends Component< {I18NextService.i18n.t("sort_type")} , + , diff --git a/src/shared/components/common/sort-select.tsx b/src/shared/components/common/sort-select.tsx index 088f45ed..fe9ba4d6 100644 --- a/src/shared/components/common/sort-select.tsx +++ b/src/shared/components/common/sort-select.tsx @@ -54,6 +54,9 @@ export class SortSelect extends Component { {I18NextService.i18n.t("active")} , ]} + {!this.props.hideMostComments && [ diff --git a/src/shared/components/post/post.tsx b/src/shared/components/post/post.tsx index 04012281..49e73486 100644 --- a/src/shared/components/post/post.tsx +++ b/src/shared/components/post/post.tsx @@ -478,6 +478,22 @@ export class Post extends Component { > {I18NextService.i18n.t("top")} + + Date: Mon, 7 Aug 2023 14:39:44 +0200 Subject: [PATCH 2/3] Fix suggested title " " spaces (#2037) * Fix imported title   spaces * Update src/shared/components/post/post-form.tsx Co-authored-by: SleeplessOne1917 * Fix lint issue --------- Co-authored-by: SleeplessOne1917 --- src/shared/components/post/post-form.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shared/components/post/post-form.tsx b/src/shared/components/post/post-form.tsx index 6c886286..7b379263 100644 --- a/src/shared/components/post/post-form.tsx +++ b/src/shared/components/post/post-form.tsx @@ -582,8 +582,10 @@ export class PostForm extends Component { case "loading": return ; case "success": { - const suggestedTitle = this.state.metadataRes.data.metadata.title; - + // Clean up the title of any extra whitespace and replace   with a space + const suggestedTitle = this.state.metadataRes.data.metadata.title + ?.trim() + .replace(/\s+/g, " "); return ( suggestedTitle && (