2023-01-29 16:59:14 +01:00
|
|
|
// Central place appending _remote internal prop
|
|
|
|
|
|
|
|
export const appendRemote = {
|
2023-02-25 23:42:04 +01:00
|
|
|
status: (status: Mastodon.Status, domain: string) => ({
|
2023-01-29 16:59:14 +01:00
|
|
|
...status,
|
|
|
|
...(status.reblog && {
|
|
|
|
reblog: {
|
|
|
|
...status.reblog,
|
2023-02-25 23:42:04 +01:00
|
|
|
account: appendRemote.account(status.reblog.account, domain),
|
|
|
|
mentions: appendRemote.mentions(status.reblog.mentions, domain)
|
2023-01-29 16:59:14 +01:00
|
|
|
}
|
|
|
|
}),
|
2023-02-25 23:42:04 +01:00
|
|
|
account: appendRemote.account(status.account, domain),
|
|
|
|
mentions: appendRemote.mentions(status.mentions, domain),
|
2023-01-29 16:59:14 +01:00
|
|
|
_remote: true
|
|
|
|
}),
|
2023-02-25 23:42:04 +01:00
|
|
|
account: (account: Mastodon.Account, domain: string) => ({
|
2023-01-29 16:59:14 +01:00
|
|
|
...account,
|
2023-02-25 23:42:04 +01:00
|
|
|
_remote: domain
|
2023-01-29 16:59:14 +01:00
|
|
|
}),
|
2023-02-25 23:42:04 +01:00
|
|
|
mentions: (mentions: Mastodon.Mention[], domain: string) =>
|
|
|
|
mentions?.map(mention => ({ ...mention, _remote: domain }))
|
2023-01-29 16:59:14 +01:00
|
|
|
}
|