mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
when replying to a note, auto-fill mentions based on the backend data instead of parsing the OP text
This commit is contained in:
parent
6c9dcb84ab
commit
a4c7f3affd
1 changed files with 2 additions and 14 deletions
|
@ -316,20 +316,8 @@ if (props.reply && (props.reply.user.username !== $i.username || (props.reply.us
|
|||
text.value = `@${props.reply.user.username}${props.reply.user.host != null ? '@' + toASCII(props.reply.user.host) : ''} `;
|
||||
}
|
||||
|
||||
if (props.reply && props.reply.text != null) {
|
||||
const ast = mfm.parse(props.reply.text);
|
||||
const otherHost = props.reply.user.host;
|
||||
|
||||
for (const x of extractMentions(ast)) {
|
||||
const mention = x.host ?
|
||||
`@${x.username}@${toASCII(x.host)}` :
|
||||
(otherHost == null || otherHost === host) ?
|
||||
`@${x.username}` :
|
||||
`@${x.username}@${toASCII(otherHost)}`;
|
||||
|
||||
// 自分は除外
|
||||
if ($i.username === x.username && (x.host == null || x.host === host)) continue;
|
||||
|
||||
if (props.reply && props.reply.mentionHandles) {
|
||||
for (const mention of Object.values(props.reply.mentionHandles)) {
|
||||
// 重複は除外
|
||||
if (text.value.includes(`${mention} `)) continue;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue