mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 11:27:31 -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}))
|
? (DriveFiles.findOneBy({id: u.bannerId}))
|
||||||
.then(p => p?.url ?? `${config.url}/static-assets/transparent.png`)
|
.then(p => p?.url ?? `${config.url}/static-assets/transparent.png`)
|
||||||
: `${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({
|
return awaitAll({
|
||||||
id: u.id,
|
id: u.id,
|
||||||
|
@ -45,8 +69,8 @@ export class UserConverter {
|
||||||
display_name: u.name || u.username,
|
display_name: u.name || u.username,
|
||||||
locked: u.isLocked,
|
locked: u.isLocked,
|
||||||
created_at: u.createdAt.toISOString(),
|
created_at: u.createdAt.toISOString(),
|
||||||
followers_count: u.followersCount,
|
followers_count: followersCount,
|
||||||
following_count: u.followingCount,
|
following_count: followingCount,
|
||||||
statuses_count: u.notesCount,
|
statuses_count: u.notesCount,
|
||||||
note: bio,
|
note: bio,
|
||||||
url: u.uri ?? acctUrl,
|
url: u.uri ?? acctUrl,
|
||||||
|
|
Loading…
Reference in a new issue