[mastodon-client] populate details for quote and reblog fields
This commit is contained in:
parent
f33ccfc98a
commit
8323a33f97
1 changed files with 12 additions and 0 deletions
|
@ -1260,6 +1260,12 @@ export default class Misskey implements MegalodonInterface {
|
||||||
if (status.account.followers_count === 0 && status.account.followers_count === 0 && status.account.statuses_count === 0)
|
if (status.account.followers_count === 0 && status.account.followers_count === 0 && status.account.statuses_count === 0)
|
||||||
status.account = await this.getAccountCached(status.account.id, status.account.acct, cache) ?? status.account;
|
status.account = await this.getAccountCached(status.account.id, status.account.acct, cache) ?? status.account;
|
||||||
|
|
||||||
|
if (status.reblog != null)
|
||||||
|
status.reblog = await this.addUserDetailsToStatus(status.reblog, cache);
|
||||||
|
|
||||||
|
if (status.quote != null)
|
||||||
|
status.quote = await this.addUserDetailsToStatus(status.quote, cache);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1267,6 +1273,12 @@ export default class Misskey implements MegalodonInterface {
|
||||||
if (status.mentions.length > 0)
|
if (status.mentions.length > 0)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
if (status.reblog != null)
|
||||||
|
status.reblog = await this.addMentionsToStatus(status.reblog, cache);
|
||||||
|
|
||||||
|
if (status.quote != null)
|
||||||
|
status.quote = await this.addMentionsToStatus(status.quote, cache);
|
||||||
|
|
||||||
status.mentions = (await this.getMentions(status.plain_content!, cache)).filter(p => p != null);
|
status.mentions = (await this.getMentions(status.plain_content!, cache)).filter(p => p != null);
|
||||||
for (const m of status.mentions.filter((value, index, array) => array.indexOf(value) === index)) {
|
for (const m of status.mentions.filter((value, index, array) => array.indexOf(value) === index)) {
|
||||||
status.content = status.content.replace(`@${m.acct}`, `<a href="${m.url}" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@${m.acct}</a>`);
|
status.content = status.content.replace(`@${m.acct}`, `<a href="${m.url}" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@${m.acct}</a>`);
|
||||||
|
|
Loading…
Reference in a new issue