Add changes for language tags

This commit is contained in:
Felix Ableitner 2022-09-14 21:44:21 +02:00
parent e266c65a7f
commit 917e411928
7 changed files with 41 additions and 5 deletions

View file

@ -19,6 +19,10 @@ export class CreateComment {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
form_id: Option<string>; form_id: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
language_id: Option<number>;
auth: string; auth: string;
constructor(init: CreateComment) { constructor(init: CreateComment) {
@ -46,6 +50,10 @@ export class EditComment {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
form_id: Option<string>; form_id: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
language_id: Option<number>;
auth: string; auth: string;
constructor(init: EditComment) { constructor(init: EditComment) {

View file

@ -195,6 +195,10 @@ export class EditCommunity {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
posting_restricted_to_mods: Option<boolean>; posting_restricted_to_mods: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
discussion_languages: Option<number[]>;
auth: string; auth: string;
constructor(init: EditCommunity) { constructor(init: EditCommunity) {

View file

@ -136,7 +136,7 @@ export class SaveUserSettings {
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
lang: Option<string>; interface_language: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()

View file

@ -29,6 +29,10 @@ export class CreatePost {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
honeypot: Option<string>; honeypot: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
language_id: Option<number>;
auth: string; auth: string;
constructor(init: CreatePost) { constructor(init: CreatePost) {
@ -149,6 +153,10 @@ export class EditPost {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
nsfw: Option<boolean>; nsfw: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
language_id: Option<number>;
auth: string; auth: string;
constructor(init: EditPost) { constructor(init: EditPost) {

View file

@ -2,7 +2,8 @@ import { Option } from "@sniptt/monads";
import { Expose, Transform, Type } from "class-transformer"; import { Expose, Transform, Type } from "class-transformer";
import "reflect-metadata"; import "reflect-metadata";
import { toOption, toUndefined } from "../../utils"; import { toOption, toUndefined } from "../../utils";
import { ListingType, SearchType, SortType, ModlogActionType } from "../others"; import { ListingType, ModlogActionType, SearchType, SortType } from "../others";
import { Language } from "../source";
import { import {
AdminPurgeCommentView, AdminPurgeCommentView,
AdminPurgeCommunityView, AdminPurgeCommunityView,
@ -96,7 +97,6 @@ export class SearchResponse {
users: PersonViewSafe[]; users: PersonViewSafe[];
} }
export class GetModlog { export class GetModlog {
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@ -296,8 +296,12 @@ export class EditSite {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
hide_modlog_mod_names: Option<boolean>; hide_modlog_mod_names: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
discussion_languages: Option<number[]>;
auth: string; auth: string;
constructor(init: EditSite) { constructor(init: EditSite) {
Object.assign(this, init); Object.assign(this, init);
} }
@ -345,6 +349,7 @@ export class GetSiteResponse {
@Expose() @Expose()
@Type(() => FederatedInstances) @Type(() => FederatedInstances)
federated_instances: Option<FederatedInstances>; federated_instances: Option<FederatedInstances>;
all_languages: Language[];
} }
/** /**
@ -361,6 +366,7 @@ export class MyUserInfo {
community_blocks: CommunityBlockView[]; community_blocks: CommunityBlockView[];
@Type(() => PersonBlockView) @Type(() => PersonBlockView)
person_blocks: PersonBlockView[]; person_blocks: PersonBlockView[];
discussion_languages: Language[];
} }
export class LeaveAdmin { export class LeaveAdmin {

View file

@ -13,7 +13,7 @@ export class LocalUserSettings {
theme: string; theme: string;
default_sort_type: number; default_sort_type: number;
default_listing_type: number; default_listing_type: number;
lang: string; interface_language: string;
show_avatars: boolean; show_avatars: boolean;
send_notifications_to_email: boolean; send_notifications_to_email: boolean;
show_bot_accounts: boolean; show_bot_accounts: boolean;
@ -200,6 +200,7 @@ export class Post {
thumbnail_url: Option<string>; thumbnail_url: Option<string>;
ap_id: string; ap_id: string;
local: boolean; local: boolean;
language_id: number;
} }
export class PasswordResetRequest { export class PasswordResetRequest {
@ -491,3 +492,9 @@ export class RegistrationApplication {
deny_reason: Option<string>; deny_reason: Option<string>;
published: string; published: string;
} }
export class Language {
id: number;
code: string;
name: string;
}

View file

@ -19,6 +19,7 @@ import {
CommentReply, CommentReply,
CommentReport, CommentReport,
CommunitySafe, CommunitySafe,
Language,
LocalUserSettings, LocalUserSettings,
ModAdd, ModAdd,
ModAddCommunity, ModAddCommunity,
@ -81,6 +82,7 @@ export class SiteView {
@Type(() => Site) @Type(() => Site)
site: Site; site: Site;
counts: SiteAggregates; counts: SiteAggregates;
languages: Language[];
} }
export class PrivateMessageView { export class PrivateMessageView {
@ -428,6 +430,7 @@ export class CommunityView {
subscribed: SubscribedType; subscribed: SubscribedType;
blocked: boolean; blocked: boolean;
counts: CommunityAggregates; counts: CommunityAggregates;
languages: Language[];
} }
export class RegistrationApplicationView { export class RegistrationApplicationView {