Skip to content

Commit

Permalink
Revert LemmyNet#1463, markdown default lang select
Browse files Browse the repository at this point in the history
  • Loading branch information
jsit committed Jun 28, 2023
1 parent 314aa79 commit 7be10eb
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 34 deletions.
4 changes: 0 additions & 4 deletions src/shared/components/comment/comment-form.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { myAuthRequired } from "@utils/app";
import getUserInterfaceLangId from "@utils/app/user-interface-language";
import { capitalizeFirstLetter } from "@utils/helpers";
import { Component } from "inferno";
import { T } from "inferno-i18next-dess";
Expand Down Expand Up @@ -41,8 +40,6 @@ export class CommentForm extends Component<CommentFormProps, any> {
: undefined
: undefined;

const userInterfaceLangId = getUserInterfaceLangId(this.props.allLanguages);

return (
<div
className={["comment-form", "mb-3", this.props.containerClass].join(
Expand All @@ -52,7 +49,6 @@ export class CommentForm extends Component<CommentFormProps, any> {
{UserService.Instance.myUserInfo ? (
<MarkdownTextArea
initialContent={initialContent}
initialLanguageId={userInterfaceLangId}
showLanguage
buttonTitle={this.buttonTitle}
finished={this.props.finished}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/common/language-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
return this.props.iconVersion ? (
this.selectBtn
) : (
<div className="language-select row mb-3">
<div className="language-select mb-3">
<label
className={classNames(
"col-form-label",
Expand Down
6 changes: 1 addition & 5 deletions src/shared/components/common/markdown-textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,8 @@ export class MarkdownTextArea extends Component<
<LanguageSelect
iconVersion
allLanguages={this.props.allLanguages}
// Only set the selected language ID if it exists as an option
// in the dropdown; otherwise, set it to 0 (Undetermined)
selectedLanguageIds={
languageId && this.props.siteLanguages.includes(languageId)
? [languageId]
: [0]
languageId ? Array.of(languageId) : undefined
}
siteLanguages={this.props.siteLanguages}
onChange={this.handleLanguageChange}
Expand Down
8 changes: 4 additions & 4 deletions src/shared/components/post/post-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
myAuth,
myAuthRequired,
} from "@utils/app";
import getUserInterfaceLangId from "@utils/app/user-interface-language";
import {
capitalizeFirstLetter,
debounce,
Expand Down Expand Up @@ -324,9 +323,10 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
}

render() {
const url = this.state.form.url;
const firstLang = this.state.form.language_id;
const selectedLangs = firstLang ? Array.of(firstLang) : undefined;

const userInterfaceLangId = getUserInterfaceLangId(this.props.allLanguages);
const url = this.state.form.url;

return (
<form className="post-form" onSubmit={linkEvent(this, handlePostSubmit)}>
Expand Down Expand Up @@ -494,8 +494,8 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
</div>
<LanguageSelect
allLanguages={this.props.allLanguages}
selectedLanguageIds={[userInterfaceLangId]}
siteLanguages={this.props.siteLanguages}
selectedLanguageIds={selectedLangs}
multiple={false}
onChange={this.handleLanguageChange}
/>
Expand Down
2 changes: 0 additions & 2 deletions src/shared/utils/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import showScores from "./show-scores";
import siteBannerCss from "./site-banner-css";
import updateCommunityBlock from "./update-community-block";
import updatePersonBlock from "./update-person-block";
import getUserInterfaceLangId from "./user-interface-language";

export {
buildCommentsTree,
Expand Down Expand Up @@ -90,7 +89,6 @@ export {
getRecipientIdFromProps,
getRoleLabelPill,
getUpdatedSearchId,
getUserInterfaceLangId,
initializeSite,
insertCommentIntoTree,
isAuthPath,
Expand Down
18 changes: 0 additions & 18 deletions src/shared/utils/app/user-interface-language.ts

This file was deleted.

0 comments on commit 7be10eb

Please sign in to comment.