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

View file

@ -195,6 +195,10 @@ export class EditCommunity {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
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;
constructor(init: EditCommunity) {

View file

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

View file

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

View file

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

View file

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

View file

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