mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-24 20:53:09 +02:00
Fix sharedInbox location (#3711)
* Fix sharedInbox location * Perform update Following * Fix comment
This commit is contained in:
parent
95c4e4497e
commit
be0cb88b6c
3 changed files with 14 additions and 3 deletions
|
@ -18,6 +18,7 @@ import Instance from '../../../models/instance';
|
||||||
import getDriveFileUrl from '../../../misc/get-drive-file-url';
|
import getDriveFileUrl from '../../../misc/get-drive-file-url';
|
||||||
import { IEmoji } from '../../../models/emoji';
|
import { IEmoji } from '../../../models/emoji';
|
||||||
import { ITag } from './tag';
|
import { ITag } from './tag';
|
||||||
|
import Following from '../../../models/following';
|
||||||
|
|
||||||
const log = debug('misskey:activitypub');
|
const log = debug('misskey:activitypub');
|
||||||
|
|
||||||
|
@ -164,7 +165,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<IU
|
||||||
publicKeyPem: person.publicKey.publicKeyPem
|
publicKeyPem: person.publicKey.publicKeyPem
|
||||||
},
|
},
|
||||||
inbox: person.inbox,
|
inbox: person.inbox,
|
||||||
sharedInbox: person.sharedInbox,
|
sharedInbox: person.sharedInbox || person.endpoints ? person.endpoints.sharedInbox : undefined,
|
||||||
featured: person.featured,
|
featured: person.featured,
|
||||||
endpoints: person.endpoints,
|
endpoints: person.endpoints,
|
||||||
uri: person.id,
|
uri: person.id,
|
||||||
|
@ -340,7 +341,7 @@ export async function updatePerson(uri: string, resolver?: Resolver, hint?: obje
|
||||||
$set: {
|
$set: {
|
||||||
lastFetchedAt: new Date(),
|
lastFetchedAt: new Date(),
|
||||||
inbox: person.inbox,
|
inbox: person.inbox,
|
||||||
sharedInbox: person.sharedInbox,
|
sharedInbox: person.sharedInbox || person.endpoints ? person.endpoints.sharedInbox : undefined,
|
||||||
featured: person.featured,
|
featured: person.featured,
|
||||||
avatarId: avatar ? avatar._id : null,
|
avatarId: avatar ? avatar._id : null,
|
||||||
bannerId: banner ? banner._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));
|
await updateFeatured(exist._id).catch(err => console.log(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ export default async (user: ILocalUser) => {
|
||||||
following: `${id}/following`,
|
following: `${id}/following`,
|
||||||
featured: `${id}/collections/featured`,
|
featured: `${id}/collections/featured`,
|
||||||
sharedInbox: `${config.url}/inbox`,
|
sharedInbox: `${config.url}/inbox`,
|
||||||
|
endpoints: { sharedInbox: `${config.url}/inbox` },
|
||||||
url: `${config.url}/@${user.username}`,
|
url: `${config.url}/@${user.username}`,
|
||||||
preferredUsername: user.username,
|
preferredUsername: user.username,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
|
|
|
@ -56,7 +56,7 @@ export interface IPerson extends IObject {
|
||||||
following: any;
|
following: any;
|
||||||
featured?: any;
|
featured?: any;
|
||||||
outbox: any;
|
outbox: any;
|
||||||
endpoints: string[];
|
endpoints: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isCollection = (object: IObject): object is ICollection =>
|
export const isCollection = (object: IObject): object is ICollection =>
|
||||||
|
|
Loading…
Reference in a new issue