summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2018-12-22 00:12:34 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2018-12-22 00:12:34 +0900
commitbe0cb88b6c77ae2e8db4c7e96ae5be6620f08507 (patch)
treea921697c148a422a1204214badcd93e72ad8a585 /src
parentFix tag not found (#3710) (diff)
downloadsharkey-be0cb88b6c77ae2e8db4c7e96ae5be6620f08507.tar.gz
sharkey-be0cb88b6c77ae2e8db4c7e96ae5be6620f08507.tar.bz2
sharkey-be0cb88b6c77ae2e8db4c7e96ae5be6620f08507.zip
Fix sharedInbox location (#3711)
* Fix sharedInbox location * Perform update Following * Fix comment
Diffstat (limited to 'src')
-rw-r--r--src/remote/activitypub/models/person.ts14
-rw-r--r--src/remote/activitypub/renderer/person.ts1
-rw-r--r--src/remote/activitypub/type.ts2
3 files changed, 14 insertions, 3 deletions
diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts
index 6f62da5ca7..e1fb91fc17 100644
--- a/src/remote/activitypub/models/person.ts
+++ b/src/remote/activitypub/models/person.ts
@@ -18,6 +18,7 @@ import Instance from '../../../models/instance';
import getDriveFileUrl from '../../../misc/get-drive-file-url';
import { IEmoji } from '../../../models/emoji';
import { ITag } from './tag';
+import Following from '../../../models/following';
const log = debug('misskey:activitypub');
@@ -164,7 +165,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<IU
publicKeyPem: person.publicKey.publicKeyPem
},
inbox: person.inbox,
- sharedInbox: person.sharedInbox,
+ sharedInbox: person.sharedInbox || person.endpoints ? person.endpoints.sharedInbox : undefined,
featured: person.featured,
endpoints: person.endpoints,
uri: person.id,
@@ -340,7 +341,7 @@ export async function updatePerson(uri: string, resolver?: Resolver, hint?: obje
$set: {
lastFetchedAt: new Date(),
inbox: person.inbox,
- sharedInbox: person.sharedInbox,
+ sharedInbox: person.sharedInbox || person.endpoints ? person.endpoints.sharedInbox : undefined,
featured: person.featured,
avatarId: avatar ? avatar._id : null,
bannerId: banner ? banner._id : null,
@@ -368,6 +369,15 @@ export async function updatePerson(uri: string, resolver?: Resolver, hint?: obje
}
});
+ // 該当ユーザーが既にフォロワーになっていた場合はFollowingもアップデートする
+ await Following.update({
+ followerId: exist._id
+ }, {
+ $set: {
+ '_follower.sharedInbox': person.sharedInbox || person.endpoints ? person.endpoints.sharedInbox : undefined
+ }
+ });
+
await updateFeatured(exist._id).catch(err => console.log(err));
}
diff --git a/src/remote/activitypub/renderer/person.ts b/src/remote/activitypub/renderer/person.ts
index d8e10708b5..aaf78444d4 100644
--- a/src/remote/activitypub/renderer/person.ts
+++ b/src/remote/activitypub/renderer/person.ts
@@ -63,6 +63,7 @@ export default async (user: ILocalUser) => {
following: `${id}/following`,
featured: `${id}/collections/featured`,
sharedInbox: `${config.url}/inbox`,
+ endpoints: { sharedInbox: `${config.url}/inbox` },
url: `${config.url}/@${user.username}`,
preferredUsername: user.username,
name: user.name,
diff --git a/src/remote/activitypub/type.ts b/src/remote/activitypub/type.ts
index 530aaa13db..9ffe73a670 100644
--- a/src/remote/activitypub/type.ts
+++ b/src/remote/activitypub/type.ts
@@ -56,7 +56,7 @@ export interface IPerson extends IObject {
following: any;
featured?: any;
outbox: any;
- endpoints: string[];
+ endpoints: any;
}
export const isCollection = (object: IObject): object is ICollection =>