mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-21 13:35:12 +00:00
fix: cover duplicated block
This commit is contained in:
parent
ccdf069cdd
commit
5518c2b7d4
1 changed files with 24 additions and 24 deletions
|
@ -214,15 +214,7 @@ export class ApNoteService {
|
|||
}
|
||||
|
||||
// 添付ファイル
|
||||
// TODO: attachmentは必ずしもImageではない
|
||||
// TODO: attachmentは必ずしも配列ではない
|
||||
const limit = promiseLimit<MiDriveFile>(2);
|
||||
const files = (await Promise.all(toArray(note.attachment).map(attach => (
|
||||
limit(() => this.apImageService.resolveImage(actor, {
|
||||
...attach,
|
||||
sensitive: note.sensitive, // Noteがsensitiveなら添付もsensitiveにする
|
||||
}))
|
||||
))));
|
||||
const files = await this.getNoteFiles(note, actor);
|
||||
|
||||
// リプライ
|
||||
const reply: MiNote | null = note.inReplyTo
|
||||
|
@ -441,21 +433,7 @@ export class ApNoteService {
|
|||
}
|
||||
|
||||
// 添付ファイル
|
||||
const attachments = toArray(note.attachment);
|
||||
if (note.image)
|
||||
for (const image of toArray(note.image))
|
||||
attachments.push(image);
|
||||
|
||||
const limit = promiseLimit<MiDriveFile>(2);
|
||||
const filePromises = attachments
|
||||
.filter(attach => typeof(attach.url) === 'string')
|
||||
.map(attach => (
|
||||
limit(() => this.apImageService.resolveImage(actor, {
|
||||
...attach,
|
||||
sensitive: note.sensitive, // Noteがsensitiveなら添付もsensitiveにする
|
||||
}))
|
||||
));
|
||||
const files = await Promise.all(filePromises);
|
||||
const files = await this.getNoteFiles(note, actor);
|
||||
|
||||
// リプライ
|
||||
const reply: MiNote | null = note.inReplyTo
|
||||
|
@ -566,6 +544,28 @@ export class ApNoteService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads all attachments from the note.
|
||||
*/
|
||||
private async getNoteFiles(note: IPost, actor: MiRemoteUser): Promise<MiDriveFile[]> {
|
||||
const attachments = toArray(note.attachment);
|
||||
if (note.image)
|
||||
for (const image of toArray(note.image))
|
||||
attachments.push(image);
|
||||
|
||||
const limit = promiseLimit<MiDriveFile>(2);
|
||||
const filePromises = attachments
|
||||
.filter(attach => typeof (attach.url) === 'string')
|
||||
.map(attach => (
|
||||
limit(() => this.apImageService.resolveImage(actor, {
|
||||
...attach,
|
||||
sensitive: note.sensitive, // Noteがsensitiveなら添付もsensitiveにする
|
||||
}))
|
||||
));
|
||||
|
||||
return await Promise.all(filePromises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Noteを解決します。
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue