feat: 凍結されたユーザーのコンテンツを見えないようにする (MisskeyIO#134)
ついでにEntityServiceの型定義、meのoptionalをやめる
This commit is contained in:
@@ -117,7 +117,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
const reports = await query.limit(ps.limit).getMany();
|
||||
|
||||
return await this.abuseUserReportEntityService.packMany(reports);
|
||||
return await this.abuseUserReportEntityService.packMany(reports, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
const files = await query.limit(ps.limit).getMany();
|
||||
|
||||
return await this.driveFileEntityService.packMany(files, { detail: true, withUser: true, self: true });
|
||||
return await this.driveFileEntityService.packMany(files, me, { detail: true, withUser: true, self: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
const reports = await query.limit(ps.limit).getMany();
|
||||
|
||||
return await this.moderationLogEntityService.packMany(reports);
|
||||
return await this.moderationLogEntityService.packMany(reports, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
secret: secret,
|
||||
}).then(x => this.appsRepository.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
return await this.appEntityService.pack(app, null, {
|
||||
return await this.appEntityService.pack(app, me, {
|
||||
detail: true,
|
||||
includeSecret: true,
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
return {
|
||||
accessToken: accessToken.token,
|
||||
user: await this.userEntityService.pack(session.userId, null, {
|
||||
user: await this.userEntityService.pack(session.userId, me, {
|
||||
detail: true,
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
const files = await query.limit(ps.limit).getMany();
|
||||
|
||||
return await this.driveFileEntityService.packMany(files, { detail: false, self: true });
|
||||
return await this.driveFileEntityService.packMany(files, me, { detail: false, self: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
requestIp: instance.enableIpLogging ? ip : null,
|
||||
requestHeaders: instance.enableIpLogging ? headers : null,
|
||||
});
|
||||
return await this.driveFileEntityService.pack(driveFile, { self: true });
|
||||
return await this.driveFileEntityService.pack(driveFile, me, { self: true });
|
||||
} catch (err) {
|
||||
if (err instanceof Error || typeof err === 'string') {
|
||||
console.error(err);
|
||||
|
||||
@@ -47,7 +47,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
userId: me.id,
|
||||
});
|
||||
|
||||
return await this.driveFileEntityService.packMany(files, { self: true });
|
||||
return await this.driveFileEntityService.packMany(files, me, { self: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
folderId: ps.folderId ?? IsNull(),
|
||||
});
|
||||
|
||||
return await Promise.all(files.map(file => this.driveFileEntityService.pack(file, { self: true })));
|
||||
return await Promise.all(files.map(file => this.driveFileEntityService.pack(file, me, { self: true })));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
return await this.driveFileEntityService.pack(file, {
|
||||
return await this.driveFileEntityService.pack(file, me, {
|
||||
detail: true,
|
||||
withUser: true,
|
||||
self: true,
|
||||
|
||||
@@ -129,7 +129,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
isSensitive: file.isSensitive,
|
||||
});
|
||||
|
||||
const fileObj = await this.driveFileEntityService.pack(file, { self: true });
|
||||
const fileObj = await this.driveFileEntityService.pack(file, me, { self: true });
|
||||
|
||||
// Publish fileUpdated event
|
||||
this.globalEventService.publishDriveStream(me.id, 'fileUpdated', fileObj);
|
||||
|
||||
@@ -51,7 +51,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
) {
|
||||
super(meta, paramDef, async (ps, user, _1, _2, _3, ip, headers) => {
|
||||
this.driveService.uploadFromUrl({ url: ps.url, user, folderId: ps.folderId, sensitive: ps.isSensitive, force: ps.force, comment: ps.comment, requestIp: ip, requestHeaders: headers }).then(file => {
|
||||
this.driveFileEntityService.pack(file, { self: true }).then(packedFile => {
|
||||
this.driveFileEntityService.pack(file, user, { self: true }).then(packedFile => {
|
||||
this.globalEventService.publishMainStream(user.id, 'urlUploadFinished', {
|
||||
marker: ps.marker,
|
||||
file: packedFile,
|
||||
|
||||
@@ -58,7 +58,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
const files = await query.limit(ps.limit).getMany();
|
||||
|
||||
return await this.driveFileEntityService.packMany(files, { detail: false, self: true });
|
||||
return await this.driveFileEntityService.packMany(files, me, { detail: false, self: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
permissions: ps.permissions,
|
||||
}).then(x => this.flashsRepository.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
return await this.flashEntityService.pack(flash);
|
||||
return await this.flashEntityService.pack(flash, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.flashEntityService.packMany(flashs);
|
||||
return await this.flashEntityService.packMany(flashs, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await Promise.all(requests.map(req => this.followRequestEntityService.pack(req)));
|
||||
return await this.followRequestEntityService.packMany(requests, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.pageEntityService.packMany(pages);
|
||||
return await this.pageEntityService.packMany(pages, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
};
|
||||
|
||||
if (ps.detail) {
|
||||
const proxyAccount = instance.proxyAccountId ? await this.userEntityService.pack(instance.proxyAccountId).catch(() => null) : null;
|
||||
const proxyAccount = instance.proxyAccountId ? await this.userEntityService.pack(instance.proxyAccountId, null).catch(() => null) : null;
|
||||
|
||||
response.proxyAccountName = proxyAccount ? proxyAccount.username : null;
|
||||
response.features = {
|
||||
|
||||
@@ -81,7 +81,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
const notes = await query.limit(ps.limit).getMany();
|
||||
|
||||
return await this.noteEntityService.packMany(notes);
|
||||
return await this.noteEntityService.packMany(notes, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
font: ps.font,
|
||||
})).then(x => this.pagesRepository.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
return await this.pageEntityService.pack(page);
|
||||
return await this.pageEntityService.pack(page, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
// Pull the user
|
||||
await this.userListJoiningsRepository.delete({ userListId: userList.id, userId: user.id });
|
||||
|
||||
this.globalEventService.publishUserListStream(userList.id, 'userRemoved', await this.userEntityService.pack(user));
|
||||
this.globalEventService.publishUserListStream(userList.id, 'userRemoved', await this.userEntityService.pack(user, me));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await this.pageEntityService.packMany(pages);
|
||||
return await this.pageEntityService.packMany(pages, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user