mirror of
https://github.com/misskey-dev/misskey.git
synced 2025-01-03 23:52:45 +01:00
enhance(backend): check visibility of reactions of remote users
This commit is contained in:
parent
4ad43bca42
commit
630bee0cc4
2 changed files with 17 additions and 14 deletions
|
@ -296,17 +296,17 @@ export class ApPersonService implements OnModuleInit {
|
||||||
|
|
||||||
const isBot = getApType(object) === 'Service' || getApType(object) === 'Application';
|
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.following, resolver),
|
||||||
this.isPublicCollection(person.followers, resolver),
|
this.isPublicCollection(person.followers, resolver),
|
||||||
].map((p): Promise<'public' | 'private'> => p
|
].map((p): Promise<boolean> => p
|
||||||
.then(isPublic => isPublic ? 'public' : 'private')
|
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (!(err instanceof StatusError) || err.isRetryable) {
|
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,
|
description: _description,
|
||||||
url,
|
url,
|
||||||
fields,
|
fields,
|
||||||
followingVisibility,
|
publicReactions,
|
||||||
followersVisibility,
|
followingVisibility: followingIsPublic ? 'public' : 'private',
|
||||||
|
followersVisibility: followersIsPublic ? 'public' : 'private',
|
||||||
birthday: bday?.[0] ?? null,
|
birthday: bday?.[0] ?? null,
|
||||||
location: person['vcard:Address'] ?? null,
|
location: person['vcard:Address'] ?? null,
|
||||||
userHost: host,
|
userHost: host,
|
||||||
|
@ -481,19 +482,19 @@ export class ApPersonService implements OnModuleInit {
|
||||||
|
|
||||||
const tags = extractApHashtags(person.tag).map(normalizeForSearch).splice(0, 32);
|
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.following, resolver),
|
||||||
this.isPublicCollection(person.followers, resolver),
|
this.isPublicCollection(person.followers, resolver),
|
||||||
].map((p): Promise<'public' | 'private' | undefined> => p
|
].map((p): Promise<boolean | undefined> => p
|
||||||
.then(isPublic => isPublic ? 'public' : 'private')
|
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (!(err instanceof StatusError) || err.isRetryable) {
|
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.
|
// Do not update the visibiility on transient errors.
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return 'private';
|
return false;
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -566,8 +567,9 @@ export class ApPersonService implements OnModuleInit {
|
||||||
url,
|
url,
|
||||||
fields,
|
fields,
|
||||||
description: _description,
|
description: _description,
|
||||||
followingVisibility,
|
publicReactions,
|
||||||
followersVisibility,
|
followingVisibility: followingIsPublic ? 'public' : followingIsPublic === false ? 'private' : undefined,
|
||||||
|
followersVisibility: followersIsPublic ? 'public' : followersIsPublic === false ? 'private' : undefined,
|
||||||
birthday: bday?.[0] ?? null,
|
birthday: bday?.[0] ?? null,
|
||||||
location: person['vcard:Address'] ?? null,
|
location: person['vcard:Address'] ?? null,
|
||||||
});
|
});
|
||||||
|
|
|
@ -179,6 +179,7 @@ export interface IActor extends IObject {
|
||||||
following?: string | ICollection | IOrderedCollection;
|
following?: string | ICollection | IOrderedCollection;
|
||||||
featured?: string | IOrderedCollection;
|
featured?: string | IOrderedCollection;
|
||||||
outbox: string | IOrderedCollection;
|
outbox: string | IOrderedCollection;
|
||||||
|
liked?: string | ICollection | IOrderedCollection;
|
||||||
endpoints?: {
|
endpoints?: {
|
||||||
sharedInbox?: string;
|
sharedInbox?: string;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue