]> Untitled Git - lemmy-ui.git/commitdiff
Lemmy 2515 controversial posts and comments (#1727)
authorPavlos Smith <57727226+iByteABit256@users.noreply.github.com>
Fri, 4 Aug 2023 20:32:07 +0000 (23:32 +0300)
committerGitHub <noreply@github.com>
Fri, 4 Aug 2023 20:32:07 +0000 (16:32 -0400)
* 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 <dessalines@users.noreply.github.com>
Co-authored-by: SleeplessOne1917 <abias1122@gmail.com>
package.json
src/shared/components/common/comment-sort-select.tsx
src/shared/components/common/sort-select.tsx
src/shared/components/post/post.tsx

index 27b9cb4f61e63138b72f16e60f4d753a7d315fd5..8e3694b9edd17c9c87c1116c59f063fb2d548540 100644 (file)
@@ -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",
index ad4eebfe8cdebe5d3310838fffbd33702147e878..f9115583b120205cd60142cf2c78fcad5d7f2ddc 100644 (file)
@@ -48,6 +48,9 @@ export class CommentSortSelect extends Component<
             {I18NextService.i18n.t("sort_type")}
           </option>
           <option value={"Hot"}>{I18NextService.i18n.t("hot")}</option>,
+          <option value={"Controversial"}>
+            {I18NextService.i18n.t("controversial")}
+          </option>
           <option value={"Top"}>{I18NextService.i18n.t("top")}</option>,
           <option value={"New"}>{I18NextService.i18n.t("new")}</option>
           <option value={"Old"}>{I18NextService.i18n.t("old")}</option>
index 088f45ed0b3ef97f7e6144e3833dac3908db9385..fe9ba4d6a23875fad6d12809dbfdffa994f1f031 100644 (file)
@@ -54,6 +54,9 @@ export class SortSelect extends Component<SortSelectProps, SortSelectState> {
               {I18NextService.i18n.t("active")}
             </option>,
           ]}
+          <option value={"Controversial"}>
+            {I18NextService.i18n.t("controversial")}
+          </option>
           <option value={"New"}>{I18NextService.i18n.t("new")}</option>
           <option value={"Old"}>{I18NextService.i18n.t("old")}</option>
           {!this.props.hideMostComments && [
index 040122818050325723f3749616aca8ccf95fca40..49e7348608960a9d12478bc04b152b9e0cb97c3e 100644 (file)
@@ -478,6 +478,22 @@ export class Post extends Component<any, PostState> {
           >
             {I18NextService.i18n.t("top")}
           </label>
+          <input
+            id={`${radioId}-controversial`}
+            type="radio"
+            className="btn-check"
+            value={"Controversial"}
+            checked={this.state.commentSort === "Controversial"}
+            onChange={linkEvent(this, this.handleCommentSortChange)}
+          />
+          <label
+            htmlFor={`${radioId}-controversial`}
+            className={classNames("btn btn-outline-secondary pointer", {
+              active: this.state.commentSort === "Controversial",
+            })}
+          >
+            {I18NextService.i18n.t("controversial")}
+          </label>
           <input
             id={`${radioId}-new`}
             type="radio"