mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 03:17:38 -07:00
[backend] Format mentions in outgoing AP messages properly
This commit is contained in:
parent
be28fae40f
commit
1ff5102e34
2 changed files with 18 additions and 4 deletions
|
@ -112,6 +112,9 @@ export function toHtml(
|
|||
},
|
||||
|
||||
mention(node) {
|
||||
const el = doc.createElement("span");
|
||||
el.setAttribute("class", "h-card");
|
||||
el.setAttribute("translate", "no");
|
||||
const a = doc.createElement("a");
|
||||
const { username, host, acct } = node.props;
|
||||
const remoteUserInfo = mentionedRemoteUsers.find(
|
||||
|
@ -124,8 +127,12 @@ export function toHtml(
|
|||
: remoteUserInfo.uri
|
||||
: `${config.url}/${acct}`;
|
||||
a.className = "u-url mention";
|
||||
a.textContent = acct;
|
||||
return a;
|
||||
const span = doc.createElement("span");
|
||||
span.textContent = username;
|
||||
a.textContent = '@';
|
||||
a.appendChild(span);
|
||||
el.appendChild(a);
|
||||
return el;
|
||||
},
|
||||
|
||||
quote(node) {
|
||||
|
|
|
@ -129,6 +129,9 @@ export class MfmHelpers {
|
|||
},
|
||||
|
||||
mention(node) {
|
||||
const el = doc.createElement("span");
|
||||
el.setAttribute("class", "h-card");
|
||||
el.setAttribute("translate", "no");
|
||||
const a = doc.createElement("a");
|
||||
const { username, host} = node.props;
|
||||
const remoteUserInfo = mentionedRemoteUsers.find(
|
||||
|
@ -143,8 +146,12 @@ export class MfmHelpers {
|
|||
: remoteUserInfo.uri
|
||||
: `${config.url}/${acct}`;
|
||||
a.className = "u-url mention";
|
||||
a.textContent = localpart;
|
||||
return a;
|
||||
const span = doc.createElement("span");
|
||||
span.textContent = username;
|
||||
a.textContent = '@';
|
||||
a.appendChild(span);
|
||||
el.appendChild(a);
|
||||
return el;
|
||||
},
|
||||
|
||||
quote(node) {
|
||||
|
|
Loading…
Reference in a new issue