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 <dessalines@users.noreply.github.com>
Co-authored-by: SleeplessOne1917 <abias1122@gmail.com>
This commit is contained in:
Pavlos Smith 2023-08-04 23:32:07 +03:00 committed by GitHub
parent 1a53a247ab
commit d923cfa522
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 1 deletions

View 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",

View 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>

View 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 && [

View 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"