mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-23 00:29:22 +09:00
enhance(backend): check visibility of reactions of remote users
This commit is contained in:
parent
4ad43bca42
commit
630bee0cc4
@ -296,17 +296,17 @@ export class ApPersonService implements OnModuleInit {
|
||||
|
||||
const isBot = getApType(object) === 'Service' || getApType(object) === 'Application';
|
||||
|
||||
const [followingVisibility, followersVisibility] = await Promise.all(
|
||||
const [publicReactions, followingIsPublic, followersIsPublic] = await Promise.all(
|
||||
[
|
||||
this.isPublicCollection(person.liked, resolver),
|
||||
this.isPublicCollection(person.following, resolver),
|
||||
this.isPublicCollection(person.followers, resolver),
|
||||
].map((p): Promise<'public' | 'private'> => p
|
||||
.then(isPublic => isPublic ? 'public' : 'private')
|
||||
].map((p): Promise<boolean> => p
|
||||
.catch(err => {
|
||||
if (!(err instanceof StatusError) || err.isRetryable) {
|
||||
this.logger.error('error occurred while fetching following/followers collection', { stack: err });
|
||||
this.logger.error('error occurred while fetching actor collection', { stack: err });
|
||||
}
|
||||
return 'private';
|
||||
return false;
|
||||
})
|
||||
)
|
||||
);
|
||||
@ -372,8 +372,9 @@ export class ApPersonService implements OnModuleInit {
|
||||
description: _description,
|
||||
url,
|
||||
fields,
|
||||
followingVisibility,
|
||||
followersVisibility,
|
||||
publicReactions,
|
||||
followingVisibility: followingIsPublic ? 'public' : 'private',
|
||||
followersVisibility: followersIsPublic ? 'public' : 'private',
|
||||
birthday: bday?.[0] ?? null,
|
||||
location: person['vcard:Address'] ?? null,
|
||||
userHost: host,
|
||||
@ -481,19 +482,19 @@ export class ApPersonService implements OnModuleInit {
|
||||
|
||||
const tags = extractApHashtags(person.tag).map(normalizeForSearch).splice(0, 32);
|
||||
|
||||
const [followingVisibility, followersVisibility] = await Promise.all(
|
||||
const [publicReactions, followingIsPublic, followersIsPublic] = await Promise.all(
|
||||
[
|
||||
this.isPublicCollection(person.liked, resolver),
|
||||
this.isPublicCollection(person.following, resolver),
|
||||
this.isPublicCollection(person.followers, resolver),
|
||||
].map((p): Promise<'public' | 'private' | undefined> => p
|
||||
.then(isPublic => isPublic ? 'public' : 'private')
|
||||
].map((p): Promise<boolean | undefined> => p
|
||||
.catch(err => {
|
||||
if (!(err instanceof StatusError) || err.isRetryable) {
|
||||
this.logger.error('error occurred while fetching following/followers collection', { stack: err });
|
||||
this.logger.error('error occurred while fetching actor collection', { stack: err });
|
||||
// Do not update the visibiility on transient errors.
|
||||
return undefined;
|
||||
}
|
||||
return 'private';
|
||||
return false;
|
||||
})
|
||||
)
|
||||
);
|
||||
@ -566,8 +567,9 @@ export class ApPersonService implements OnModuleInit {
|
||||
url,
|
||||
fields,
|
||||
description: _description,
|
||||
followingVisibility,
|
||||
followersVisibility,
|
||||
publicReactions,
|
||||
followingVisibility: followingIsPublic ? 'public' : followingIsPublic === false ? 'private' : undefined,
|
||||
followersVisibility: followersIsPublic ? 'public' : followersIsPublic === false ? 'private' : undefined,
|
||||
birthday: bday?.[0] ?? null,
|
||||
location: person['vcard:Address'] ?? null,
|
||||
});
|
||||
|
@ -179,6 +179,7 @@ export interface IActor extends IObject {
|
||||
following?: string | ICollection | IOrderedCollection;
|
||||
featured?: string | IOrderedCollection;
|
||||
outbox: string | IOrderedCollection;
|
||||
liked?: string | ICollection | IOrderedCollection;
|
||||
endpoints?: {
|
||||
sharedInbox?: string;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user