feat: 凍結されたユーザーのコンテンツを見えないようにする (MisskeyIO#134)

ついでにEntityServiceの型定義、meのoptionalをやめる
This commit is contained in:
まっちゃとーにゅ
2023-08-08 20:13:05 +09:00
committed by GitHub
parent 3b73874196
commit 7f0acd3ea4
70 changed files with 742 additions and 325 deletions

View File

@@ -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);

View File

@@ -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 });
});
}
}

View File

@@ -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 })));
});
}
}

View File

@@ -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,

View File

@@ -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);

View File

@@ -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,