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