mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 08:53:48 +01:00
[backend] Format mentions in outgoing AP messages properly
This commit is contained in:
parent
be28fae40f
commit
1ff5102e34
@ -112,6 +112,9 @@ export function toHtml(
|
|||||||
},
|
},
|
||||||
|
|
||||||
mention(node) {
|
mention(node) {
|
||||||
|
const el = doc.createElement("span");
|
||||||
|
el.setAttribute("class", "h-card");
|
||||||
|
el.setAttribute("translate", "no");
|
||||||
const a = doc.createElement("a");
|
const a = doc.createElement("a");
|
||||||
const { username, host, acct } = node.props;
|
const { username, host, acct } = node.props;
|
||||||
const remoteUserInfo = mentionedRemoteUsers.find(
|
const remoteUserInfo = mentionedRemoteUsers.find(
|
||||||
@ -124,8 +127,12 @@ export function toHtml(
|
|||||||
: remoteUserInfo.uri
|
: remoteUserInfo.uri
|
||||||
: `${config.url}/${acct}`;
|
: `${config.url}/${acct}`;
|
||||||
a.className = "u-url mention";
|
a.className = "u-url mention";
|
||||||
a.textContent = acct;
|
const span = doc.createElement("span");
|
||||||
return a;
|
span.textContent = username;
|
||||||
|
a.textContent = '@';
|
||||||
|
a.appendChild(span);
|
||||||
|
el.appendChild(a);
|
||||||
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
quote(node) {
|
quote(node) {
|
||||||
|
@ -129,6 +129,9 @@ export class MfmHelpers {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mention(node) {
|
mention(node) {
|
||||||
|
const el = doc.createElement("span");
|
||||||
|
el.setAttribute("class", "h-card");
|
||||||
|
el.setAttribute("translate", "no");
|
||||||
const a = doc.createElement("a");
|
const a = doc.createElement("a");
|
||||||
const { username, host} = node.props;
|
const { username, host} = node.props;
|
||||||
const remoteUserInfo = mentionedRemoteUsers.find(
|
const remoteUserInfo = mentionedRemoteUsers.find(
|
||||||
@ -143,8 +146,12 @@ export class MfmHelpers {
|
|||||||
: remoteUserInfo.uri
|
: remoteUserInfo.uri
|
||||||
: `${config.url}/${acct}`;
|
: `${config.url}/${acct}`;
|
||||||
a.className = "u-url mention";
|
a.className = "u-url mention";
|
||||||
a.textContent = localpart;
|
const span = doc.createElement("span");
|
||||||
return a;
|
span.textContent = username;
|
||||||
|
a.textContent = '@';
|
||||||
|
a.appendChild(span);
|
||||||
|
el.appendChild(a);
|
||||||
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
quote(node) {
|
quote(node) {
|
||||||
|
Loading…
Reference in New Issue
Block a user