revert 44ff9f39: pass access token through API to enforce rank
This commit is contained in:
parent
d7a629e178
commit
7f547a8c10
166 changed files with 377 additions and 472 deletions
|
|
@ -201,7 +201,7 @@ export class ApiServerService {
|
|||
return {
|
||||
ok: true,
|
||||
token: token.token,
|
||||
user: await this.userEntityService.pack(token.userId, null, { schema: 'UserDetailedNotMe', token }),
|
||||
user: await this.userEntityService.pack(token.userId, null, { schema: 'UserDetailedNotMe' }),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private abuseUserReportEntityService: AbuseUserReportEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.abuseUserReportsRepository.createQueryBuilder('report'), ps.sinceId, ps.untilId)
|
||||
.leftJoinAndSelect('report.targetUser', 'targetUser')
|
||||
.leftJoinAndSelect('targetUser.userProfile', 'targetUserProfile')
|
||||
|
|
@ -147,7 +147,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const reports = await query.limit(ps.limit).getMany();
|
||||
|
||||
return await this.abuseUserReportEntityService.packMany(reports, me, token);
|
||||
return await this.abuseUserReportEntityService.packMany(reports, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noPermission);
|
||||
}
|
||||
|
||||
if (me && !await this.roleService.isAdministrator(me, token)) {
|
||||
if (me && !await this.roleService.isAdministrator(me)) {
|
||||
// Only administrators (including root) can create users.
|
||||
throw new ApiError(meta.errors.noAdmin);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private userEntityService: UserEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const profile = await this.userProfilesRepository.findOne({
|
||||
where: { email: ps.email },
|
||||
relations: ['user'],
|
||||
|
|
@ -59,7 +59,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const res = await this.userEntityService.pack(profile.user!, me, {
|
||||
schema: 'UserDetailedNotMe',
|
||||
token,
|
||||
});
|
||||
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private roleService: RoleService,
|
||||
private idService: IdService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const file = ps.fileId ? await this.driveFilesRepository.findOneBy({ id: ps.fileId }) : await this.driveFilesRepository.findOne({
|
||||
where: [{
|
||||
url: ps.url,
|
||||
|
|
@ -204,7 +204,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
id: file.userId,
|
||||
}) : null;
|
||||
|
||||
const iAmModerator = await this.roleService.isModerator(me, token);
|
||||
const iAmModerator = await this.roleService.isModerator(me);
|
||||
const ownerIsModerator = owner ? await this.roleService.isModerator(owner) : false;
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private idService: IdService,
|
||||
private moderationLogService: ModerationLogService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
if (ps.expiresAt && isNaN(Date.parse(ps.expiresAt))) {
|
||||
throw new ApiError(meta.errors.invalidDateTime);
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
invitations: tickets,
|
||||
});
|
||||
|
||||
return await this.inviteCodeEntityService.packMany(tickets, me, token);
|
||||
return await this.inviteCodeEntityService.packMany(tickets, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private inviteCodeEntityService: InviteCodeEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.registrationTicketsRepository.createQueryBuilder('ticket')
|
||||
.leftJoinAndSelect('ticket.createdBy', 'createdBy')
|
||||
.leftJoinAndSelect('ticket.usedBy', 'usedBy');
|
||||
|
|
@ -70,7 +70,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const tickets = await query.getMany();
|
||||
|
||||
return await this.inviteCodeEntityService.packMany(tickets, me, token);
|
||||
return await this.inviteCodeEntityService.packMany(tickets, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,13 +65,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const role = await this.rolesRepository.findOneBy({ id: ps.roleId });
|
||||
if (role == null) {
|
||||
throw new ApiError(meta.errors.noSuchRole);
|
||||
}
|
||||
|
||||
if (!role.canEditMembersByModerator && !(await this.roleService.isAdministrator(me, token))) {
|
||||
if (!role.canEditMembersByModerator && !(await this.roleService.isAdministrator(me))) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,13 +67,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const role = await this.rolesRepository.findOneBy({ id: ps.roleId });
|
||||
if (role == null) {
|
||||
throw new ApiError(meta.errors.noSuchRole);
|
||||
}
|
||||
|
||||
if (!role.canEditMembersByModerator && !(await this.roleService.isAdministrator(me, token))) {
|
||||
if (!role.canEditMembersByModerator && !(await this.roleService.isAdministrator(me))) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private moderationLogEntityService: ModerationLogEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.moderationLogsRepository.createQueryBuilder('report'), ps.sinceId, ps.untilId);
|
||||
|
||||
if (ps.type != null) {
|
||||
|
|
@ -91,7 +91,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const reports = await query.limit(ps.limit).getMany();
|
||||
|
||||
return await this.moderationLogEntityService.packMany(reports, me, token);
|
||||
return await this.moderationLogEntityService.packMany(reports);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private idService: IdService,
|
||||
private readonly cacheService: CacheService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const [user, profile] = await Promise.all([
|
||||
this.usersRepository.findOneBy({ id: ps.userId }),
|
||||
this.userProfilesRepository.findOneBy({ userId: ps.userId }),
|
||||
|
|
@ -269,7 +269,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const isSilenced = user.isSilenced || !(await this.roleService.getUserPolicies(user.id)).canPublicNote;
|
||||
|
||||
const _me = await this.usersRepository.findOneByOrFail({ id: me.id });
|
||||
if (!await this.roleService.isAdministrator(_me, token) && await this.roleService.isAdministrator(user)) {
|
||||
if (!await this.roleService.isAdministrator(_me) && await this.roleService.isAdministrator(user)) {
|
||||
throw new Error('cannot show info of admin');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private readonly roleService: RoleService,
|
||||
private readonly globalEventService: GlobalEventService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const user = await this.cacheService.findUserById(ps.userId);
|
||||
|
||||
if (await this.roleService.isModerator(user, token)) {
|
||||
if (await this.roleService.isModerator(user)) {
|
||||
throw new Error('cannot silence moderator account');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userSuspendService: UserSuspendService,
|
||||
private roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const user = await this.usersRepository.findOneBy({ id: ps.userId });
|
||||
|
||||
if (user == null) {
|
||||
|
|
@ -44,7 +44,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
if (user.isSuspended) return;
|
||||
|
||||
if (await this.roleService.isModerator(user, token)) {
|
||||
if (await this.roleService.isModerator(user)) {
|
||||
throw new Error('cannot suspend moderator account');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,14 +40,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private moderationLogService: ModerationLogService,
|
||||
private systemAccountService: SystemAccountService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const proxy = await this.systemAccountService.updateCorrespondingUserProfile('proxy', {
|
||||
description: ps.description,
|
||||
});
|
||||
|
||||
const updated = await this.userEntityService.pack(proxy.id, proxy, {
|
||||
schema: 'MeDetailed',
|
||||
token,
|
||||
});
|
||||
|
||||
if (ps.description !== undefined) {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private globalEventService: GlobalEventService,
|
||||
private readonly activeUsersChart: ActiveUsersChart,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const untilId = ps.untilId ?? (ps.untilDate ? this.idService.gen(ps.untilDate!) : null);
|
||||
const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.gen(ps.sinceDate!) : null);
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
this.activeUsersChart.read(me);
|
||||
});
|
||||
|
||||
return await this.noteEntityService.packMany(notes, me, token);
|
||||
return await this.noteEntityService.packMany(notes, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import { ApRequestService } from '@/core/activitypub/ApRequestService.js';
|
|||
import { SystemAccountService } from '@/core/SystemAccountService.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { MiAccessToken } from '@/models/AccessToken.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['federation'],
|
||||
|
|
@ -122,8 +121,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private readonly apRequestService: ApRequestService,
|
||||
private readonly systemAccountService: SystemAccountService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
const object = await this.fetchAny(ps.uri, me, token);
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const object = await this.fetchAny(ps.uri, me);
|
||||
if (object) {
|
||||
return object;
|
||||
} else {
|
||||
|
|
@ -136,12 +135,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
* URIからUserかNoteを解決する
|
||||
*/
|
||||
@bindThis
|
||||
private async fetchAny(uri: string, me: MiLocalUser | null | undefined, token?: MiAccessToken | null): Promise<SchemaType<typeof meta['res']> | null> {
|
||||
private async fetchAny(uri: string, me: MiLocalUser | null | undefined): Promise<SchemaType<typeof meta['res']> | null> {
|
||||
if (!this.utilityService.isFederationAllowedUri(uri)) {
|
||||
throw new ApiError(meta.errors.federationNotAllowed);
|
||||
}
|
||||
|
||||
const local = await this.mergePack(me, token, ...await Promise.all([
|
||||
const local = await this.mergePack(me, ...await Promise.all([
|
||||
this.apDbResolverService.getUserFromApId(uri),
|
||||
this.apDbResolverService.getNoteFromApId(uri),
|
||||
]));
|
||||
|
|
@ -199,22 +198,21 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
// The resolve* methods automatically check for locally cached copies.
|
||||
return await this.mergePack(
|
||||
me,
|
||||
token,
|
||||
isActor(object) ? await this.apPersonService.resolvePerson(object, resolver, uri) : null,
|
||||
isPost(object) ? await this.apNoteService.resolveNote(object, { resolver, sentFrom: uri }) : null,
|
||||
);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
private async mergePack(me: MiLocalUser | null | undefined, token: MiAccessToken | null | undefined, user: MiUser | null | undefined, note: MiNote | null | undefined): Promise<SchemaType<typeof meta.res> | null> {
|
||||
private async mergePack(me: MiLocalUser | null | undefined, user: MiUser | null | undefined, note: MiNote | null | undefined): Promise<SchemaType<typeof meta.res> | null> {
|
||||
if (user != null) {
|
||||
return {
|
||||
type: 'User',
|
||||
object: await this.userEntityService.pack(user, me, { schema: 'UserDetailedNotMe', token }),
|
||||
object: await this.userEntityService.pack(user, me, { schema: 'UserDetailedNotMe' }),
|
||||
};
|
||||
} else if (note != null) {
|
||||
try {
|
||||
const object = await this.noteEntityService.pack(note, me, token, { detail: true });
|
||||
const object = await this.noteEntityService.pack(note, me, { detail: true });
|
||||
|
||||
return {
|
||||
type: 'Note',
|
||||
|
|
|
|||
|
|
@ -119,7 +119,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
accessToken: accessToken.token,
|
||||
user: await this.userEntityService.pack(session.userId, me, {
|
||||
schema: 'UserDetailedNotMe',
|
||||
token: accessToken,
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userBlockingService: UserBlockingService,
|
||||
private userMutingService: UserMutingService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const blocker = await this.usersRepository.findOneByOrFail({ id: me.id });
|
||||
|
||||
// 自分自身
|
||||
|
|
@ -120,7 +120,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
return await this.userEntityService.pack(blockee.id, blocker, {
|
||||
schema: 'UserDetailedNotMe',
|
||||
token,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userBlockingService: UserBlockingService,
|
||||
private userMutingService: UserMutingService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const blocker = await this.usersRepository.findOneByOrFail({ id: me.id });
|
||||
|
||||
// Check if the blockee is yourself
|
||||
|
|
@ -119,7 +119,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
return await this.userEntityService.pack(blockee.id, blocker, {
|
||||
schema: 'UserDetailedNotMe',
|
||||
token,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private blockingEntityService: BlockingEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.blockingsRepository.createQueryBuilder('blocking'), ps.sinceId, ps.untilId)
|
||||
.andWhere('blocking.blockerId = :meId', { meId: me.id });
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.blockingEntityService.packMany(blockings, me, token);
|
||||
return await this.blockingEntityService.packMany(blockings, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private userEntityService: UserEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps) => {
|
||||
const records = await this.bubbleGameRecordsRepository.find({
|
||||
where: {
|
||||
gameMode: ps.gameMode,
|
||||
|
|
@ -77,7 +77,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
relations: ['user'],
|
||||
});
|
||||
|
||||
const users = await this.userEntityService.packMany(records.map(r => r.user!), me, { token });
|
||||
const users = await this.userEntityService.packMany(records.map(r => r.user!), me);
|
||||
|
||||
return records.map(r => ({
|
||||
id: r.id,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private idService: IdService,
|
||||
private channelEntityService: ChannelEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
let banner = null;
|
||||
if (ps.bannerId != null) {
|
||||
banner = await this.driveFilesRepository.findOneBy({
|
||||
|
|
@ -91,7 +91,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
allowRenoteToExternal: ps.allowRenoteToExternal ?? true,
|
||||
} as MiChannel);
|
||||
|
||||
return await this.channelEntityService.pack(channel, me, token);
|
||||
return await this.channelEntityService.pack(channel, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private channelEntityService: ChannelEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.channelsRepository.createQueryBuilder('channel')
|
||||
.where('channel.lastNotedAt IS NOT NULL')
|
||||
.andWhere('channel.isArchived = FALSE')
|
||||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const channels = await query.limit(10).getMany();
|
||||
|
||||
return await Promise.all(channels.map(x => this.channelEntityService.pack(x, me, token)));
|
||||
return await Promise.all(channels.map(x => this.channelEntityService.pack(x, me)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private channelEntityService: ChannelEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService
|
||||
.makePaginationQuery(
|
||||
this.channelFollowingsRepository.createQueryBuilder(),
|
||||
|
|
@ -69,7 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await Promise.all(followings.map(x => this.channelEntityService.pack(x.followeeId, me, token)));
|
||||
return await Promise.all(followings.map(x => this.channelEntityService.pack(x.followeeId, me)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private channelEntityService: ChannelEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.channelFavoritesRepository.createQueryBuilder('favorite')
|
||||
.andWhere('favorite.userId = :meId', { meId: me.id })
|
||||
.leftJoinAndSelect('favorite.channel', 'channel');
|
||||
|
|
@ -56,7 +56,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const favorites = await query
|
||||
.getMany();
|
||||
|
||||
return await Promise.all(favorites.map(x => this.channelEntityService.pack(x.channel!, me, token)));
|
||||
return await Promise.all(favorites.map(x => this.channelEntityService.pack(x.channel!, me)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private channelEntityService: ChannelEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.channelsRepository.createQueryBuilder('channel'), ps.sinceId, ps.untilId)
|
||||
.andWhere('channel.isArchived = FALSE')
|
||||
.andWhere({ userId: me.id });
|
||||
|
|
@ -62,7 +62,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await Promise.all(channels.map(x => this.channelEntityService.pack(x, me, token)));
|
||||
return await Promise.all(channels.map(x => this.channelEntityService.pack(x, me)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private channelEntityService: ChannelEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const channel = await this.channelsRepository.findOneBy({
|
||||
id: ps.channelId,
|
||||
});
|
||||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchChannel);
|
||||
}
|
||||
|
||||
return await this.channelEntityService.pack(channel, me, token, true);
|
||||
return await this.channelEntityService.pack(channel, me, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private activeUsersChart: ActiveUsersChart,
|
||||
private readonly cacheService: CacheService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const untilId = ps.untilId ?? (ps.untilDate ? this.idService.gen(ps.untilDate!) : null);
|
||||
const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.gen(ps.sinceDate!) : null);
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
}
|
||||
|
||||
if (!this.serverSettings.enableFanoutTimeline) {
|
||||
return await this.noteEntityService.packMany(await this.getFromDb({ untilId, sinceId, limit: ps.limit, channelId: channel.id, withFiles: ps.withFiles, withRenotes: ps.withRenotes }, me), me, token);
|
||||
return await this.noteEntityService.packMany(await this.getFromDb({ untilId, sinceId, limit: ps.limit, channelId: channel.id, withFiles: ps.withFiles, withRenotes: ps.withRenotes }, me), me);
|
||||
}
|
||||
|
||||
return await this.fanoutTimelineEndpointService.timeline({
|
||||
|
|
@ -113,7 +113,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
limit: ps.limit,
|
||||
allowPartial: ps.allowPartial,
|
||||
me,
|
||||
token,
|
||||
useDbFallback: true,
|
||||
redisTimelines: [`channelTimeline:${channel.id}`],
|
||||
excludePureRenotes: !ps.withRenotes,
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const channel = await this.channelsRepository.findOneBy({
|
||||
id: ps.channelId,
|
||||
});
|
||||
|
|
@ -94,7 +94,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchChannel);
|
||||
}
|
||||
|
||||
const iAmModerator = await this.roleService.isModerator(me, token);
|
||||
const iAmModerator = await this.roleService.isModerator(me);
|
||||
if (channel.userId !== me.id && !iAmModerator) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
...(typeof ps.allowRenoteToExternal === 'boolean' ? { allowRenoteToExternal: ps.allowRenoteToExternal } : {}),
|
||||
});
|
||||
|
||||
return await this.channelEntityService.pack(channel.id, me, token);
|
||||
return await this.channelEntityService.pack(channel.id, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private readonly cacheService: CacheService,
|
||||
private readonly roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const profile = await this.cacheService.userProfileCache.fetch(ps.userId);
|
||||
|
||||
// These are structured weird to avoid un-necessary calls to roleService and cacheService
|
||||
const iAmModeratorOrTarget = me && (me.id === ps.userId || await this.roleService.isModerator(me, token));
|
||||
const iAmModeratorOrTarget = me && (me.id === ps.userId || await this.roleService.isModerator(me));
|
||||
const iAmFollowingOrTarget = me && (me.id === ps.userId || await this.cacheService.isFollowing(me.id, ps.userId));
|
||||
|
||||
const canViewFollowing =
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private chatEntityService: ChatEntityService,
|
||||
private chatService: ChatService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
await this.chatService.checkChatAvailability(me.id, 'read');
|
||||
|
||||
const room = await this.chatService.findRoomById(ps.roomId);
|
||||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchRoom);
|
||||
}
|
||||
|
||||
if (!await this.chatService.hasPermissionToViewRoomTimeline(me.id, room, token)) {
|
||||
if (!await this.chatService.hasPermissionToViewRoomTimeline(me.id, room)) {
|
||||
throw new ApiError(meta.errors.noSuchRoom);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,14 +49,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private roleService: RoleService,
|
||||
private chatEntityService: ChatEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
await this.chatService.checkChatAvailability(me.id, 'read');
|
||||
|
||||
const message = await this.chatService.findMessageById(ps.messageId);
|
||||
if (message == null) {
|
||||
throw new ApiError(meta.errors.noSuchMessage);
|
||||
}
|
||||
if (message.fromUserId !== me.id && message.toUserId !== me.id && !(await this.roleService.isModerator(me, token))) {
|
||||
if (message.fromUserId !== me.id && message.toUserId !== me.id && !(await this.roleService.isModerator(me))) {
|
||||
throw new ApiError(meta.errors.noSuchMessage);
|
||||
}
|
||||
return this.chatEntityService.packMessageDetailed(message, me);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
constructor(
|
||||
private chatService: ChatService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
await this.chatService.checkChatAvailability(me.id, 'write');
|
||||
|
||||
const room = await this.chatService.findRoomById(ps.roomId);
|
||||
|
|
@ -46,7 +46,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchRoom);
|
||||
}
|
||||
|
||||
if (!await this.chatService.hasPermissionToDeleteRoom(me.id, room, token)) {
|
||||
if (!await this.chatService.hasPermissionToDeleteRoom(me.id, room)) {
|
||||
throw new ApiError(meta.errors.noSuchRoom);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private clipEntityService: ClipEntityService,
|
||||
private clipService: ClipService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
let clip: MiClip;
|
||||
try {
|
||||
// 空文字列をnullにしたいので??は使わない
|
||||
|
|
@ -68,7 +68,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
}
|
||||
throw e;
|
||||
}
|
||||
return await this.clipEntityService.pack(clip, me, token);
|
||||
return await this.clipEntityService.pack(clip, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private clipEntityService: ClipEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const clips = await this.clipsRepository.findBy({
|
||||
userId: me.id,
|
||||
});
|
||||
|
||||
return await this.clipEntityService.packMany(clips, me, token);
|
||||
return await this.clipEntityService.packMany(clips, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private clipEntityService: ClipEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.clipFavoritesRepository.createQueryBuilder('favorite')
|
||||
.andWhere('favorite.userId = :meId', { meId: me.id })
|
||||
.leftJoinAndSelect('favorite.clip', 'clip');
|
||||
|
|
@ -56,7 +56,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const favorites = await query
|
||||
.getMany();
|
||||
|
||||
return this.clipEntityService.packMany(favorites.map(x => x.clip!), me, token);
|
||||
return this.clipEntityService.packMany(favorites.map(x => x.clip!), me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private noteEntityService: NoteEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const clip = await this.clipsRepository.findOneBy({
|
||||
id: ps.clipId,
|
||||
});
|
||||
|
|
@ -104,7 +104,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.noteEntityService.packMany(notes, me, token);
|
||||
return await this.noteEntityService.packMany(notes, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private clipEntityService: ClipEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
// Fetch the clip
|
||||
const clip = await this.clipsRepository.findOneBy({
|
||||
id: ps.clipId,
|
||||
|
|
@ -68,7 +68,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchClip);
|
||||
}
|
||||
|
||||
return await this.clipEntityService.pack(clip, me, token);
|
||||
return await this.clipEntityService.pack(clip, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private clipEntityService: ClipEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
try {
|
||||
// 空文字列をnullにしたいので??は使わない
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
|
|
@ -69,7 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw e;
|
||||
}
|
||||
|
||||
return await this.clipEntityService.pack(ps.clipId, me, token);
|
||||
return await this.clipEntityService.pack(ps.clipId, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,14 +60,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private roleService: RoleService,
|
||||
private globalEventService: GlobalEventService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const file = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
||||
|
||||
if (file == null) {
|
||||
throw new ApiError(meta.errors.noSuchFile);
|
||||
}
|
||||
|
||||
if (!await this.roleService.isModerator(me, token) && (file.userId !== me.id)) {
|
||||
if (!await this.roleService.isModerator(me) && (file.userId !== me.id)) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private driveFileEntityService: DriveFileEntityService,
|
||||
private roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
let file: MiDriveFile | null = null;
|
||||
|
||||
if (ps.fileId) {
|
||||
|
|
@ -90,7 +90,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchFile);
|
||||
}
|
||||
|
||||
if (!await this.roleService.isModerator(me, token) && (file.userId !== me.id)) {
|
||||
if (!await this.roleService.isModerator(me) && (file.userId !== me.id)) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,13 +94,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private driveService: DriveService,
|
||||
private roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const file = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
||||
if (file == null) {
|
||||
throw new ApiError(meta.errors.noSuchFile);
|
||||
}
|
||||
|
||||
if (!await this.roleService.isModerator(me, token) && (file.userId !== me.id)) {
|
||||
if (!await this.roleService.isModerator(me) && (file.userId !== me.id)) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
constructor(
|
||||
private followingEntityService: FollowingEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
return this.followingEntityService.getFollowers(me, token, ps);
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
return this.followingEntityService.getFollowers(me, ps);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
constructor(
|
||||
private followingEntityService: FollowingEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
return this.followingEntityService.getFollowing(me, token, ps);
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
return this.followingEntityService.getFollowing(me, ps);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private instanceEntityService: InstanceEntityService,
|
||||
private metaService: MetaService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.instancesRepository.createQueryBuilder('instance');
|
||||
|
||||
switch (ps.sort) {
|
||||
|
|
@ -191,7 +191,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const instances = await query.limit(ps.limit).offset(ps.offset).getMany();
|
||||
|
||||
return await this.instanceEntityService.packMany(instances, me, token);
|
||||
return await this.instanceEntityService.packMany(instances, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private utilityService: UtilityService,
|
||||
private instanceEntityService: InstanceEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const instance = await this.instancesRepository
|
||||
.findOneBy({ host: this.utilityService.toPuny(ps.host) });
|
||||
|
||||
return instance ? await this.instanceEntityService.pack(instance, me, token) : null;
|
||||
return instance ? await this.instanceEntityService.pack(instance, me) : null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private instanceEntityService: InstanceEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const [topSubInstances, topPubInstances, allSubCount, allPubCount] = await Promise.all([
|
||||
this.instancesRepository.find({
|
||||
where: {
|
||||
|
|
@ -114,9 +114,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const gotPubCount = topPubInstances.map(x => x.followingCount).reduce((a, b) => a + b, 0);
|
||||
|
||||
return await awaitAll({
|
||||
topSubInstances: this.instanceEntityService.packMany(topSubInstances, me, token),
|
||||
topSubInstances: this.instanceEntityService.packMany(topSubInstances, me),
|
||||
otherFollowersCount: Math.max(0, allSubCount - gotSubCount),
|
||||
topPubInstances: this.instanceEntityService.packMany(topPubInstances, me, token),
|
||||
topPubInstances: this.instanceEntityService.packMany(topPubInstances, me),
|
||||
otherFollowingCount: Math.max(0, allPubCount - gotPubCount),
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userEntityService: UserEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.usersRepository.createQueryBuilder('user'), ps.sinceId, ps.untilId)
|
||||
.andWhere('user.host = :host', { host: ps.host });
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailedNotMe', token });
|
||||
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailedNotMe' });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private flashEntityService: FlashEntityService,
|
||||
private idService: IdService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const flash = await this.flashsRepository.insertOne({
|
||||
id: this.idService.gen(),
|
||||
userId: me.id,
|
||||
|
|
@ -70,7 +70,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
visibility: ps.visibility,
|
||||
});
|
||||
|
||||
return await this.flashEntityService.pack(flash, me, token);
|
||||
return await this.flashEntityService.pack(flash, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,14 +59,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private moderationLogService: ModerationLogService,
|
||||
private roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const flash = await this.flashsRepository.findOneBy({ id: ps.flashId });
|
||||
|
||||
if (flash == null) {
|
||||
throw new ApiError(meta.errors.noSuchFlash);
|
||||
}
|
||||
|
||||
if (!await this.roleService.isModerator(me, token) && flash.userId !== me.id) {
|
||||
if (!await this.roleService.isModerator(me) && flash.userId !== me.id) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private flashService: FlashService,
|
||||
private flashEntityService: FlashEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const result = await this.flashService.featured({
|
||||
offset: ps.offset,
|
||||
limit: ps.limit,
|
||||
});
|
||||
return await this.flashEntityService.packMany(result, me, token);
|
||||
return await this.flashEntityService.packMany(result, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private flashLikeEntityService: FlashLikeEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.flashLikesRepository.createQueryBuilder('like'), ps.sinceId, ps.untilId)
|
||||
.andWhere('like.userId = :meId', { meId: me.id })
|
||||
.leftJoinAndSelect('like.flash', 'flash');
|
||||
|
|
@ -72,7 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return this.flashLikeEntityService.packMany(likes, me, token);
|
||||
return this.flashLikeEntityService.packMany(likes, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private flashEntityService: FlashEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.flashsRepository.createQueryBuilder('flash'), ps.sinceId, ps.untilId)
|
||||
.andWhere('flash.userId = :meId', { meId: me.id });
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.flashEntityService.packMany(flashs, me, token);
|
||||
return await this.flashEntityService.packMany(flashs, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,14 +52,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private flashEntityService: FlashEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const flash = await this.flashsRepository.findOneBy({ id: ps.flashId });
|
||||
|
||||
if (flash == null) {
|
||||
throw new ApiError(meta.errors.noSuchFlash);
|
||||
}
|
||||
|
||||
return await this.flashEntityService.pack(flash, me, token);
|
||||
return await this.flashEntityService.pack(flash, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private getterService: GetterService,
|
||||
private userFollowingService: UserFollowingService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const follower = me;
|
||||
|
||||
// 自分自身
|
||||
|
|
@ -111,7 +111,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw e;
|
||||
}
|
||||
|
||||
return await this.userEntityService.pack(followee.id, me, { token });
|
||||
return await this.userEntityService.pack(followee.id, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
|||
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { GetterService } from '@/server/api/GetterService.js';
|
||||
import { CacheService } from '@/core/CacheService.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { CacheService } from '@/core/CacheService.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['following', 'users'],
|
||||
|
|
@ -72,7 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userFollowingService: UserFollowingService,
|
||||
private readonly cacheService: CacheService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const follower = me;
|
||||
|
||||
// Check if the followee is yourself
|
||||
|
|
@ -95,7 +95,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
await this.userFollowingService.unfollow(follower, followee);
|
||||
|
||||
return await this.userEntityService.pack(followee.id, me, { token });
|
||||
return await this.userEntityService.pack(followee.id, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userFollowingService: UserFollowingService,
|
||||
private readonly cacheService: CacheService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const followee = me;
|
||||
|
||||
// Check if the follower is yourself
|
||||
|
|
@ -95,7 +95,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
await this.userFollowingService.unfollow(follower, followee);
|
||||
|
||||
return await this.userEntityService.pack(follower.id, me, { token });
|
||||
return await this.userEntityService.pack(follower.id, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private getterService: GetterService,
|
||||
private userFollowingService: UserFollowingService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
// Fetch followee
|
||||
const followee = await this.getterService.getUser(ps.userId).catch(err => {
|
||||
if (err.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
|
||||
|
|
@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw err;
|
||||
}
|
||||
|
||||
return await this.userEntityService.pack(followee.id, me, { token });
|
||||
return await this.userEntityService.pack(followee.id, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private followRequestEntityService: FollowRequestEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.followRequestsRepository.createQueryBuilder('request'), ps.sinceId, ps.untilId)
|
||||
.andWhere('request.followeeId = :meId', { meId: me.id });
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.followRequestEntityService.packMany(requests, me, token);
|
||||
return await this.followRequestEntityService.packMany(requests, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private followRequestEntityService: FollowRequestEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.followRequestsRepository.createQueryBuilder('request'), ps.sinceId, ps.untilId)
|
||||
.andWhere('request.followerId = :meId', { meId: me.id });
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.followRequestEntityService.packMany(requests, me, token);
|
||||
return await this.followRequestEntityService.packMany(requests, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userFollowingService: UserFollowingService,
|
||||
private readonly cacheService: CacheService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const follower = me;
|
||||
|
||||
// Check if the follower is yourself
|
||||
|
|
@ -104,7 +104,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
await this.cacheService.refreshFollowRelationsFor(follower.id);
|
||||
|
||||
return await this.userEntityService.pack(follower.id, me, { token });
|
||||
return await this.userEntityService.pack(follower.id, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private galleryPostEntityService: GalleryPostEntityService,
|
||||
private featuredService: FeaturedService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
let postIds: string[];
|
||||
if (this.galleryPostsRankingCacheLastFetchedAt !== 0 && (Date.now() - this.galleryPostsRankingCacheLastFetchedAt < 1000 * 60 * 30)) {
|
||||
postIds = this.galleryPostsRankingCache;
|
||||
|
|
@ -78,7 +78,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const posts = await query.getMany();
|
||||
|
||||
return await this.galleryPostEntityService.packMany(posts, me, token);
|
||||
return await this.galleryPostEntityService.packMany(posts, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,14 +45,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private galleryPostEntityService: GalleryPostEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.galleryPostsRepository.createQueryBuilder('post')
|
||||
.andWhere('post.likedCount > 0')
|
||||
.orderBy('post.likedCount', 'DESC');
|
||||
|
||||
const posts = await query.limit(10).getMany();
|
||||
|
||||
return await this.galleryPostEntityService.packMany(posts, me, token);
|
||||
return await this.galleryPostEntityService.packMany(posts, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private galleryPostEntityService: GalleryPostEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.galleryPostsRepository.createQueryBuilder('post'), ps.sinceId, ps.untilId)
|
||||
.innerJoinAndSelect('post.user', 'user');
|
||||
|
||||
const posts = await query.limit(ps.limit).getMany();
|
||||
|
||||
return await this.galleryPostEntityService.packMany(posts, me, token);
|
||||
return await this.galleryPostEntityService.packMany(posts, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private galleryPostEntityService: GalleryPostEntityService,
|
||||
private idService: IdService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const files = (await Promise.all(ps.fileIds.map(fileId =>
|
||||
this.driveFilesRepository.findOneBy({
|
||||
id: fileId,
|
||||
|
|
@ -85,7 +85,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
fileIds: files.map(file => file.id),
|
||||
}));
|
||||
|
||||
return await this.galleryPostEntityService.pack(post, me, token);
|
||||
return await this.galleryPostEntityService.pack(post, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,14 +59,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private moderationLogService: ModerationLogService,
|
||||
private roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const post = await this.galleryPostsRepository.findOneBy({ id: ps.postId });
|
||||
|
||||
if (post == null) {
|
||||
throw new ApiError(meta.errors.noSuchPost);
|
||||
}
|
||||
|
||||
if (!await this.roleService.isModerator(me, token) && post.userId !== me.id) {
|
||||
if (!await this.roleService.isModerator(me) && post.userId !== me.id) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private galleryPostEntityService: GalleryPostEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const post = await this.galleryPostsRepository.findOneBy({
|
||||
id: ps.postId,
|
||||
});
|
||||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchPost);
|
||||
}
|
||||
|
||||
return await this.galleryPostEntityService.pack(post, me, token);
|
||||
return await this.galleryPostEntityService.pack(post, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private galleryPostEntityService: GalleryPostEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
let files: Array<MiDriveFile> | undefined;
|
||||
|
||||
if (ps.fileIds) {
|
||||
|
|
@ -90,7 +90,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const post = await this.galleryPostsRepository.findOneByOrFail({ id: ps.postId });
|
||||
|
||||
return await this.galleryPostEntityService.pack(post, me, token);
|
||||
return await this.galleryPostEntityService.pack(post, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
private userEntityService: UserEntityService,
|
||||
private globalEventService: GlobalEventService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, at) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const token = ps.token;
|
||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: me.id });
|
||||
|
||||
|
|
@ -120,7 +120,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
|
||||
schema: 'MeDetailed',
|
||||
includeSecrets: true,
|
||||
token: at,
|
||||
}));
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userEntityService: UserEntityService,
|
||||
private globalEventService: GlobalEventService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
if (ps.value === true) {
|
||||
// セキュリティキーがなければパスワードレスを有効にはできない
|
||||
const keyCount = await this.userSecurityKeysRepository.count({
|
||||
|
|
@ -83,7 +83,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
|
||||
schema: 'MeDetailed',
|
||||
includeSecrets: true,
|
||||
token,
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userAuthService: UserAuthService,
|
||||
private globalEventService: GlobalEventService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, at) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const token = ps.token;
|
||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: me.id });
|
||||
|
||||
|
|
@ -107,7 +107,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
|
||||
schema: 'MeDetailed',
|
||||
includeSecrets: true,
|
||||
token: at,
|
||||
}));
|
||||
|
||||
return {};
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userAuthService: UserAuthService,
|
||||
private globalEventService: GlobalEventService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, at) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const token = ps.token;
|
||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: me.id });
|
||||
|
||||
|
|
@ -85,7 +85,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
|
||||
schema: 'MeDetailed',
|
||||
includeSecrets: true,
|
||||
token: at,
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userEntityService: UserEntityService,
|
||||
private globalEventService: GlobalEventService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const key = await this.userSecurityKeysRepository.findOneBy({
|
||||
id: ps.credentialId,
|
||||
});
|
||||
|
|
@ -77,7 +77,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
|
||||
schema: 'MeDetailed',
|
||||
includeSecrets: true,
|
||||
token,
|
||||
}));
|
||||
|
||||
return {};
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private readonly cacheService: CacheService,
|
||||
private idService: IdService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, at) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.accessTokensRepository.createQueryBuilder('token')
|
||||
.where('token.userId = :userId', { userId: me.id })
|
||||
.leftJoinAndSelect('token.app', 'app');
|
||||
|
|
@ -111,7 +111,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const tokens = await query.getMany();
|
||||
|
||||
const users = await this.cacheService.getUsers(tokens.flatMap(token => token.granteeIds));
|
||||
const packedUsers = await this.userEntityService.packMany(Array.from(users.values()), me, { token: at });
|
||||
const packedUsers = await this.userEntityService.packMany(Array.from(users.values()), me);
|
||||
const packedUserMap = new Map(packedUsers.map(u => [u.id, u]));
|
||||
|
||||
return tokens.map(token => ({
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private noteFavoriteEntityService: NoteFavoriteEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.noteFavoritesRepository.createQueryBuilder('favorite'), ps.sinceId, ps.untilId)
|
||||
.andWhere('favorite.userId = :meId', { meId: me.id })
|
||||
.leftJoinAndSelect('favorite.note', 'note');
|
||||
|
|
@ -62,7 +62,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.noteFavoriteEntityService.packMany(favorites, me, token);
|
||||
return await this.noteFavoriteEntityService.packMany(favorites, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private galleryLikeEntityService: GalleryLikeEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.galleryLikesRepository.createQueryBuilder('like'), ps.sinceId, ps.untilId)
|
||||
.andWhere('like.userId = :meId', { meId: me.id })
|
||||
.leftJoinAndSelect('like.post', 'post');
|
||||
|
|
@ -73,7 +73,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.galleryLikeEntityService.packMany(likes, me, token);
|
||||
return await this.galleryLikeEntityService.packMany(likes, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private galleryPostEntityService: GalleryPostEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.galleryPostsRepository.createQueryBuilder('post'), ps.sinceId, ps.untilId)
|
||||
.andWhere('post.userId = :meId', { meId: me.id });
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.galleryPostEntityService.packMany(posts, me, token);
|
||||
return await this.galleryPostEntityService.packMany(posts, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private notificationEntityService: NotificationEntityService,
|
||||
private notificationService: NotificationService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const EXTRA_LIMIT = 100;
|
||||
|
||||
// includeTypes が空の場合はクエリしない
|
||||
|
|
@ -191,7 +191,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
// this matches the logic in NotificationService and it's what MkPagination expects
|
||||
if (ps.sinceId && !ps.untilId) groupedNotifications.reverse();
|
||||
|
||||
return await this.notificationEntityService.packGroupedMany(groupedNotifications, me.id, token);
|
||||
return await this.notificationEntityService.packGroupedMany(groupedNotifications, me.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private notificationEntityService: NotificationEntityService,
|
||||
private notificationService: NotificationService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
// includeTypes が空の場合はクエリしない
|
||||
if (ps.includeTypes && ps.includeTypes.length === 0) {
|
||||
return [];
|
||||
|
|
@ -95,7 +95,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
this.notificationService.readAllNotification(me.id);
|
||||
}
|
||||
|
||||
return await this.notificationEntityService.packMany(notifications, me.id, token);
|
||||
return await this.notificationEntityService.packMany(notifications, me.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private pageLikeEntityService: PageLikeEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.pageLikesRepository.createQueryBuilder('like'), ps.sinceId, ps.untilId)
|
||||
.andWhere('like.userId = :meId', { meId: me.id })
|
||||
.leftJoinAndSelect('like.page', 'page');
|
||||
|
|
@ -72,7 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return this.pageLikeEntityService.packMany(likes, me, token);
|
||||
return this.pageLikeEntityService.packMany(likes, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private pageEntityService: PageEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.pagesRepository.createQueryBuilder('page'), ps.sinceId, ps.untilId)
|
||||
.andWhere('page.userId = :meId', { meId: me.id });
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.pageEntityService.packMany(pages, me, token);
|
||||
return await this.pageEntityService.packMany(pages);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userEntityService: UserEntityService,
|
||||
private notePiningService: NotePiningService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
await this.notePiningService.addPinned(me, ps.noteId).catch(err => {
|
||||
if (err.id === '70c4e51f-5bea-449c-a030-53bee3cce202') throw new ApiError(meta.errors.noSuchNote);
|
||||
if (err.id === '15a018eb-58e5-4da1-93be-330fcc5e4e1a') throw new ApiError(meta.errors.pinLimitExceeded);
|
||||
|
|
@ -74,7 +74,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
return await this.userEntityService.pack(me.id, me, {
|
||||
schema: 'MeDetailed',
|
||||
token,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,14 +72,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private readonly userEntityService: UserEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const tokens = await this.accessTokensRepository
|
||||
.createQueryBuilder('token')
|
||||
.where(':meIdAsList <@ token.granteeIds', { meIdAsList: [me.id] })
|
||||
.getMany();
|
||||
|
||||
const userIds = tokens.map(token => token.userId);
|
||||
const packedUsers = await this.userEntityService.packMany(userIds, me, { token });
|
||||
const packedUsers = await this.userEntityService.packMany(userIds, me);
|
||||
const packedUserMap = new Map(packedUsers.map(u => [u.id, u]));
|
||||
|
||||
return tokens.map(token => ({
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userEntityService: UserEntityService,
|
||||
private notePiningService: NotePiningService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
await this.notePiningService.removePinned(me, ps.noteId).catch(err => {
|
||||
if (err.id === 'b302d4cf-c050-400a-bbb3-be208681f40c') throw new ApiError(meta.errors.noSuchNote);
|
||||
throw err;
|
||||
|
|
@ -59,7 +59,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
return await this.userEntityService.pack(me.id, me, {
|
||||
schema: 'MeDetailed',
|
||||
token,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userAuthService: UserAuthService,
|
||||
private globalEventService: GlobalEventService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, at) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const token = ps.token;
|
||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: me.id });
|
||||
|
||||
|
|
@ -119,7 +119,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const iObj = await this.userEntityService.pack(me.id, me, {
|
||||
schema: 'MeDetailed',
|
||||
includeSecrets: true,
|
||||
token: at,
|
||||
});
|
||||
|
||||
// Publish meUpdated event
|
||||
|
|
|
|||
|
|
@ -629,7 +629,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const iObj = await this.userEntityService.pack(user.id, user, {
|
||||
schema: 'MeDetailed',
|
||||
includeSecrets: isSecure,
|
||||
token,
|
||||
});
|
||||
|
||||
const updatedProfile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private idService: IdService,
|
||||
private roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const policies = await this.roleService.getUserPolicies(me.id);
|
||||
|
||||
if (policies.inviteLimit) {
|
||||
|
|
@ -80,7 +80,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
code: generateInviteCode(),
|
||||
});
|
||||
|
||||
return await this.inviteCodeEntityService.pack(ticket, me, token);
|
||||
return await this.inviteCodeEntityService.pack(ticket, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,9 +60,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const ticket = await this.registrationTicketsRepository.findOneBy({ id: ps.inviteId });
|
||||
const isModerator = await this.roleService.isModerator(me, token);
|
||||
const isModerator = await this.roleService.isModerator(me);
|
||||
|
||||
if (ticket == null) {
|
||||
throw new ApiError(meta.errors.noSuchCode);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private inviteCodeEntityService: InviteCodeEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.registrationTicketsRepository.createQueryBuilder('ticket'), ps.sinceId, ps.untilId)
|
||||
.andWhere('ticket.createdById = :meId', { meId: me.id })
|
||||
.leftJoinAndSelect('ticket.createdBy', 'createdBy')
|
||||
|
|
@ -63,7 +63,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.inviteCodeEntityService.packMany(tickets, me, token);
|
||||
return await this.inviteCodeEntityService.packMany(tickets, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private mutingEntityService: MutingEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.mutingsRepository.createQueryBuilder('muting'), ps.sinceId, ps.untilId)
|
||||
.andWhere('muting.muterId = :meId', { meId: me.id });
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.mutingEntityService.packMany(mutings, me, token);
|
||||
return await this.mutingEntityService.packMany(mutings, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private roleService: RoleService,
|
||||
private activeUsersChart: ActiveUsersChart,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const policies = await this.roleService.getUserPolicies(me ? me.id : null);
|
||||
if (!policies.btlAvailable) {
|
||||
throw new ApiError(meta.errors.btlDisabled);
|
||||
|
|
@ -126,7 +126,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
});
|
||||
}
|
||||
|
||||
return await this.noteEntityService.packMany(timeline, me, token);
|
||||
return await this.noteEntityService.packMany(timeline, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private noteEntityService: NoteEntityService,
|
||||
private queryService: QueryService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
||||
.andWhere(new Brackets(qb => {
|
||||
qb.orWhere('note.replyId = :noteId');
|
||||
|
|
@ -85,7 +85,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const notes = await query.getMany();
|
||||
|
||||
return await this.noteEntityService.packMany(notes, me, token);
|
||||
return await this.noteEntityService.packMany(notes, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private clipEntityService: ClipEntityService,
|
||||
private getterService: GetterService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const note = await this.getterService.getNote(ps.noteId).catch(err => {
|
||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
||||
throw err;
|
||||
|
|
@ -77,7 +77,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
isPublic: true,
|
||||
});
|
||||
|
||||
return await this.clipEntityService.packMany(clips, me, token);
|
||||
return await this.clipEntityService.packMany(clips, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private noteEntityService: NoteEntityService,
|
||||
private getterService: GetterService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const note = await this.getterService.getNote(ps.noteId).catch(err => {
|
||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
||||
throw err;
|
||||
|
|
@ -93,10 +93,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
}
|
||||
|
||||
if (note.hasPoll) {
|
||||
return await this.noteEntityService.packMany(conversation, me, token, { detail: true });
|
||||
return await this.noteEntityService.packMany(conversation, me, { detail: true });
|
||||
}
|
||||
|
||||
return await this.noteEntityService.packMany(conversation, me, token);
|
||||
return await this.noteEntityService.packMany(conversation, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private noteCreateService: NoteCreateService,
|
||||
private readonly noteVisibilityService: NoteVisibilityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
if (ps.text && ps.text.length > this.config.maxNoteLength) {
|
||||
throw new ApiError(meta.errors.maxLength);
|
||||
}
|
||||
|
|
@ -417,7 +417,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
});
|
||||
|
||||
return {
|
||||
createdNote: await this.noteEntityService.pack(note, me, token),
|
||||
createdNote: await this.noteEntityService.pack(note, me),
|
||||
};
|
||||
} catch (e) {
|
||||
// TODO: 他のErrorもここでキャッチしてエラーメッセージを当てるようにしたい
|
||||
|
|
|
|||
|
|
@ -59,13 +59,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private roleService: RoleService,
|
||||
private noteDeleteService: NoteDeleteService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const note = await this.getterService.getNote(ps.noteId).catch(err => {
|
||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
||||
throw err;
|
||||
});
|
||||
|
||||
if (!await this.roleService.isModerator(me, token) && (note.userId !== me.id)) {
|
||||
if (!await this.roleService.isModerator(me) && (note.userId !== me.id)) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private noteEditService: NoteEditService,
|
||||
private readonly noteVisibilityService: NoteVisibilityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
if (ps.text && ps.text.length > this.config.maxNoteLength) {
|
||||
throw new ApiError(meta.errors.maxLength);
|
||||
}
|
||||
|
|
@ -472,7 +472,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
});
|
||||
|
||||
return {
|
||||
createdNote: await this.noteEntityService.pack(note, me, token),
|
||||
createdNote: await this.noteEntityService.pack(note, me),
|
||||
};
|
||||
} catch (e) {
|
||||
// TODO: 他のErrorもここでキャッチしてエラーメッセージを当てるようにしたい
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queryService: QueryService,
|
||||
private readonly roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const policies = await this.roleService.getUserPolicies(me ? me.id : null);
|
||||
if (!policies.ltlAvailable) {
|
||||
throw new ApiError(meta.errors.ltlDisabled);
|
||||
|
|
@ -126,7 +126,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
notes.sort((a, b) => a.id > b.id ? -1 : 1);
|
||||
|
||||
return await this.noteEntityService.packMany(notes, me, token);
|
||||
return await this.noteEntityService.packMany(notes, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private readonly queryService: QueryService,
|
||||
private readonly activeUsersChart: ActiveUsersChart,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
if (ps.includeReplies && ps.filesOnly) throw new ApiError(meta.errors.bothWithRepliesAndWithFiles);
|
||||
if (ps.list === 'followers' && ps.includeNonPublic) throw new ApiError(meta.errors.bothWithFollowersAndIncludeNonPublic);
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
this.activeUsersChart.read(me);
|
||||
});
|
||||
|
||||
return await this.noteEntityService.packMany(notes, me, token, { skipHide: true });
|
||||
return await this.noteEntityService.packMany(notes, me, { skipHide: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private activeUsersChart: ActiveUsersChart,
|
||||
private readonly cacheService: CacheService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me, token) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const policies = await this.roleService.getUserPolicies(me ? me.id : null);
|
||||
if (!policies.gtlAvailable) {
|
||||
throw new ApiError(meta.errors.gtlDisabled);
|
||||
|
|
@ -118,7 +118,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
});
|
||||
}
|
||||
|
||||
return await this.noteEntityService.packMany(timeline, me, token);
|
||||
return await this.noteEntityService.packMany(timeline, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue