feat(backend): support isSensitive in channel endpoints
This commit is contained in:
parent
aacde76f43
commit
11593a76b0
|
@ -87,6 +87,7 @@ export class ChannelEntityService {
|
|||
isArchived: channel.isArchived,
|
||||
usersCount: channel.usersCount,
|
||||
notesCount: channel.notesCount,
|
||||
isSensitive: channel.isSensitive,
|
||||
|
||||
...(me ? {
|
||||
isFollowing,
|
||||
|
|
|
@ -67,5 +67,9 @@ export const packedChannelSchema = {
|
|||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
isSensitive: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
|
|
@ -44,6 +44,7 @@ export const paramDef = {
|
|||
description: { type: 'string', nullable: true, minLength: 1, maxLength: 2048 },
|
||||
bannerId: { type: 'string', format: 'misskey:id', nullable: true },
|
||||
color: { type: 'string', minLength: 1, maxLength: 16 },
|
||||
isSensitive: { type: 'boolean', nullable: true },
|
||||
},
|
||||
required: ['name'],
|
||||
} as const;
|
||||
|
@ -81,6 +82,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
name: ps.name,
|
||||
description: ps.description ?? null,
|
||||
bannerId: banner ? banner.id : null,
|
||||
isSensitive: ps.isSensitive ?? false,
|
||||
...(ps.color !== undefined ? { color: ps.color } : {}),
|
||||
} as Channel).then(x => this.channelsRepository.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ export const paramDef = {
|
|||
},
|
||||
},
|
||||
color: { type: 'string', minLength: 1, maxLength: 16 },
|
||||
isSensitive: { type: 'boolean', nullable: true },
|
||||
},
|
||||
required: ['channelId'],
|
||||
} as const;
|
||||
|
@ -109,6 +110,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
...(ps.color !== undefined ? { color: ps.color } : {}),
|
||||
...(typeof ps.isArchived === 'boolean' ? { isArchived: ps.isArchived } : {}),
|
||||
...(banner ? { bannerId: banner.id } : {}),
|
||||
...(typeof ps.isSensitive === 'boolean' ? { isSensitive: ps.isSensitive } : {}),
|
||||
});
|
||||
|
||||
return await this.channelEntityService.pack(channel.id, me);
|
||||
|
|
Loading…
Reference in New Issue