add MiUserProfile.defaultCW property and API
This commit is contained in:
parent
8a087e75a5
commit
74407bc8ee
7 changed files with 47 additions and 3 deletions
|
|
@ -133,6 +133,12 @@ export const meta = {
|
|||
id: '0b3f9f6a-2f4d-4b1f-9fb4-49d3a2fd7191',
|
||||
httpStatusCode: 422,
|
||||
},
|
||||
|
||||
maxCwLength: {
|
||||
message: 'You tried setting a default content warning which is too long.',
|
||||
code: 'MAX_CW_LENGTH',
|
||||
id: '7004c478-bda3-4b4f-acb2-4316398c9d52',
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
|
|
@ -243,6 +249,7 @@ export const paramDef = {
|
|||
uniqueItems: true,
|
||||
items: { type: 'string' },
|
||||
},
|
||||
defaultCW: { type: 'string', nullable: true },
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
|
@ -494,6 +501,16 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
updates.alsoKnownAs = newAlsoKnownAs.size > 0 ? Array.from(newAlsoKnownAs) : null;
|
||||
}
|
||||
|
||||
let defaultCW = ps.defaultCW;
|
||||
if (defaultCW !== undefined) {
|
||||
if (defaultCW === '') defaultCW = null;
|
||||
if (defaultCW && defaultCW.length > this.config.maxCwLength) {
|
||||
throw new ApiError(meta.errors.maxCwLength);
|
||||
}
|
||||
|
||||
profileUpdates.defaultCW = defaultCW;
|
||||
}
|
||||
|
||||
//#region emojis/tags
|
||||
|
||||
let emojis = [] as string[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue