summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/act
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-08 07:11:29 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-08 07:11:29 +0900
commit04cdb04ee2d80ce37a7fd6d8e7dfa47cff539d8f (patch)
tree45543caa3d8ff423a5797b68e7256c5db88dfcf6 /src/remote/activitypub/act
parentImplement announce (diff)
downloadsharkey-04cdb04ee2d80ce37a7fd6d8e7dfa47cff539d8f.tar.gz
sharkey-04cdb04ee2d80ce37a7fd6d8e7dfa47cff539d8f.tar.bz2
sharkey-04cdb04ee2d80ce37a7fd6d8e7dfa47cff539d8f.zip
Fix bug
Diffstat (limited to 'src/remote/activitypub/act')
-rw-r--r--src/remote/activitypub/act/create/image.ts2
-rw-r--r--src/remote/activitypub/act/create/note.ts10
2 files changed, 5 insertions, 7 deletions
diff --git a/src/remote/activitypub/act/create/image.ts b/src/remote/activitypub/act/create/image.ts
index c87423c5fd..f1462f4ee4 100644
--- a/src/remote/activitypub/act/create/image.ts
+++ b/src/remote/activitypub/act/create/image.ts
@@ -12,7 +12,7 @@ export default async function(actor: IRemoteUser, image): Promise<IDriveFile> {
throw new Error('invalid image');
}
- log(`Creating the Image: ${image.id}`);
+ log(`Creating the Image: ${image.url}`);
return await uploadFromUrl(image.url, actor);
}
diff --git a/src/remote/activitypub/act/create/note.ts b/src/remote/activitypub/act/create/note.ts
index 572a293ab4..599bc10aa8 100644
--- a/src/remote/activitypub/act/create/note.ts
+++ b/src/remote/activitypub/act/create/note.ts
@@ -37,15 +37,13 @@ export default async function createNote(resolver: Resolver, actor: IRemoteUser,
//#endergion
//#region 添付メディア
- const media = [];
+ let media = [];
if ('attachment' in note && note.attachment != null) {
// TODO: attachmentは必ずしもImageではない
// TODO: attachmentは必ずしも配列ではない
- // TODO: ループの中でawaitはすべきでない
- note.attachment.forEach(async media => {
- const created = await createImage(note.actor, media);
- media.push(created);
- });
+ media = await Promise.all(note.attachment.map(x => {
+ return createImage(actor, x);
+ }));
}
//#endregion