fix: acct issues on megalodon
This commit is contained in:
parent
d3832f2560
commit
15c43372f9
1 changed files with 20 additions and 21 deletions
|
@ -69,13 +69,14 @@ namespace MisskeyAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const user = (u: Entity.User, host: string | null = null): MegalodonEntity.Account => {
|
export const user = (u: Entity.User, host: string | null = null): MegalodonEntity.Account => {
|
||||||
host ? host = host.replace("https://", "") : null;
|
let acct = u.username;
|
||||||
let acct = u.username
|
host ? host = host.replace("https://", "") : undefined;
|
||||||
if (host) {
|
let acctUrl = `https://${host || u.host || host}/@${
|
||||||
acct = `@${u.username}@${host}`
|
u.username
|
||||||
}
|
}`;
|
||||||
if (u.host) {
|
if (u.host) {
|
||||||
acct = `@${u.username}@${u.host}`
|
acct = `${u.username}@${u.host}`;
|
||||||
|
acctUrl = `https://${u.host}/@${u.username}`;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
id: u.id,
|
id: u.id,
|
||||||
|
@ -92,9 +93,9 @@ namespace MisskeyAPI {
|
||||||
following_count: u.followingCount ? u.followingCount : 0,
|
following_count: u.followingCount ? u.followingCount : 0,
|
||||||
statuses_count: u.notesCount ? u.notesCount : 0,
|
statuses_count: u.notesCount ? u.notesCount : 0,
|
||||||
note: '',
|
note: '',
|
||||||
url: u.host ? `https://${u.host}/@${u.username}` : host ? `https://${host}/@${u.username}` : acct,
|
url: acctUrl,
|
||||||
avatar: u.avatarUrl,
|
avatar: u.avatarUrl,
|
||||||
avatar_static: u.avatarColor,
|
avatar_static: u.avatarUrl,
|
||||||
header: '',
|
header: '',
|
||||||
header_static: '',
|
header_static: '',
|
||||||
emojis: mapEmojis(u.emojis),
|
emojis: mapEmojis(u.emojis),
|
||||||
|
@ -105,13 +106,11 @@ namespace MisskeyAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const userDetail = (u: Entity.UserDetail, host: string | null = null): MegalodonEntity.Account => {
|
export const userDetail = (u: Entity.UserDetail, host: string | null = null): MegalodonEntity.Account => {
|
||||||
host ? host = host.replace("https://", "") : null;
|
let acct = u.username;
|
||||||
let acct = u.username
|
let acctUrl = `https://${u.host || host}/@${u.username}`;
|
||||||
if (host) {
|
|
||||||
acct = `@${u.username}@${host}`
|
|
||||||
}
|
|
||||||
if (u.host) {
|
if (u.host) {
|
||||||
acct = `@${u.username}@${u.host}`
|
acct = `${u.username}@${u.host}`;
|
||||||
|
acctUrl = `https://${u.host}/@${u.username}`;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
id: u.id,
|
id: u.id,
|
||||||
|
@ -128,11 +127,11 @@ namespace MisskeyAPI {
|
||||||
following_count: u.followingCount,
|
following_count: u.followingCount,
|
||||||
statuses_count: u.notesCount,
|
statuses_count: u.notesCount,
|
||||||
note: u.description ? u.description : '',
|
note: u.description ? u.description : '',
|
||||||
url: u.host ? `https://${u.host}/@${u.username}` : host ? `https://${host}/@${u.username}` : acct,
|
url: acctUrl,
|
||||||
avatar: u.avatarUrl,
|
avatar: u.avatarUrl,
|
||||||
avatar_static: u.avatarColor,
|
avatar_static: u.avatarUrl,
|
||||||
header: u.bannerUrl,
|
header: u.bannerUrl,
|
||||||
header_static: u.bannerColor,
|
header_static: u.bannerUrl,
|
||||||
emojis: mapEmojis(u.emojis),
|
emojis: mapEmojis(u.emojis),
|
||||||
moved: null,
|
moved: null,
|
||||||
fields: [],
|
fields: [],
|
||||||
|
|
Loading…
Reference in a new issue