]> Untitled Git - lemmy-ui.git/blobdiff - src/shared/components/post/post-form.tsx
Changing all bigints to numbers
[lemmy-ui.git] / src / shared / components / post / post-form.tsx
index c24e890a6eba52a9aa1b56dbd2d07872ec227e4e..ef168374a7b1e87e3cab9f631334bf55cac8e0fc 100644 (file)
@@ -5,13 +5,10 @@ import {
   CreatePost,
   EditPost,
   Language,
-  ListingType,
   PostResponse,
   PostView,
   Search,
   SearchResponse,
-  SearchType,
-  SortType,
   UserOperation,
   wsJsonToRes,
   wsUserOp,
@@ -21,9 +18,9 @@ import { i18n } from "../../i18next";
 import { PostFormParams } from "../../interfaces";
 import { UserService, WebSocketService } from "../../services";
 import {
+  Choice,
   archiveTodayUrl,
   capitalizeFirstLetter,
-  Choice,
   communityToChoice,
   debounce,
   fetchCommunities,
@@ -32,7 +29,6 @@ import {
   ghostArchiveUrl,
   isImage,
   myAuth,
-  myFirstDiscussionLanguageId,
   pictrsDeleteToast,
   relTags,
   setupTippy,
@@ -190,13 +186,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
   }
 
   render() {
-    let firstLang =
-      this.state.form.language_id ??
-      myFirstDiscussionLanguageId(
-        this.props.allLanguages,
-        this.props.siteLanguages,
-        UserService.Instance.myUserInfo
-      );
+    let firstLang = this.state.form.language_id;
     let selectedLangs = firstLang ? Array.of(firstLang) : undefined;
 
     let url = this.state.form.url;
@@ -516,9 +506,9 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
     if (url && validURL(url)) {
       let form: Search = {
         q: url,
-        type_: SearchType.Url,
-        sort: SortType.TopAll,
-        listing_type: ListingType.All,
+        type_: "Url",
+        sort: "TopAll",
+        listing_type: "All",
         page: 1,
         limit: trendingFetchLimit,
         auth: myAuth(false),
@@ -545,9 +535,9 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
     if (q && q !== "") {
       let form: Search = {
         q,
-        type_: SearchType.Posts,
-        sort: SortType.TopAll,
-        listing_type: ListingType.All,
+        type_: "Posts",
+        sort: "TopAll",
+        listing_type: "All",
         community_id: this.state.form.community_id,
         page: 1,
         limit: trendingFetchLimit,
@@ -687,9 +677,9 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
     } else if (op == UserOperation.Search) {
       let data = wsJsonToRes<SearchResponse>(msg);
 
-      if (data.type_ == SearchType[SearchType.Posts]) {
+      if (data.type_ == "Posts") {
         this.setState({ suggestedPosts: data.posts });
-      } else if (data.type_ == SearchType[SearchType.Url]) {
+      } else if (data.type_ == "Url") {
         this.setState({ crossPosts: data.posts });
       }
     }