mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
[mastodon-client] Respect ffVisibility
This commit is contained in:
parent
a515b6b4d4
commit
7f6ac71dd0
1 changed files with 26 additions and 2 deletions
|
@ -37,6 +37,30 @@ export class UserConverter {
|
|||
? (DriveFiles.findOneBy({id: u.bannerId}))
|
||||
.then(p => p?.url ?? `${config.url}/static-assets/transparent.png`)
|
||||
: `${config.url}/static-assets/transparent.png`;
|
||||
const followersCount = profile.then(profile => {
|
||||
if (profile === null) return u.followersCount;
|
||||
switch (profile.ffVisibility) {
|
||||
case "public":
|
||||
return u.followersCount;
|
||||
case "followers":
|
||||
// FIXME: check following relationship
|
||||
return 0;
|
||||
case "private":
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
const followingCount = profile.then(profile => {
|
||||
if (profile === null) return u.followingCount;
|
||||
switch (profile.ffVisibility) {
|
||||
case "public":
|
||||
return u.followingCount;
|
||||
case "followers":
|
||||
// FIXME: check following relationship
|
||||
return 0;
|
||||
case "private":
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
return awaitAll({
|
||||
id: u.id,
|
||||
|
@ -45,8 +69,8 @@ export class UserConverter {
|
|||
display_name: u.name || u.username,
|
||||
locked: u.isLocked,
|
||||
created_at: u.createdAt.toISOString(),
|
||||
followers_count: u.followersCount,
|
||||
following_count: u.followingCount,
|
||||
followers_count: followersCount,
|
||||
following_count: followingCount,
|
||||
statuses_count: u.notesCount,
|
||||
note: bio,
|
||||
url: u.uri ?? acctUrl,
|
||||
|
|
Loading…
Reference in a new issue