CreatePost,
EditPost,
Language,
- ListingType,
PostResponse,
PostView,
Search,
SearchResponse,
- SearchType,
- SortType,
UserOperation,
wsJsonToRes,
wsUserOp,
import { PostFormParams } from "../../interfaces";
import { UserService, WebSocketService } from "../../services";
import {
+ Choice,
archiveTodayUrl,
capitalizeFirstLetter,
- Choice,
communityToChoice,
debounce,
fetchCommunities,
ghostArchiveUrl,
isImage,
myAuth,
- myFirstDiscussionLanguageId,
pictrsDeleteToast,
relTags,
setupTippy,
}
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;
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),
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,
} 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 });
}
}