From 3eef0a65c2a47a696e2a4f35ebd2fde876c71ef5 Mon Sep 17 00:00:00 2001
From: nullobsi <me@nullob.si>
Date: Thu, 2 Dec 2021 03:27:42 -0800
Subject: fix mentions in replies (#8030)

---
 packages/client/src/components/post-form.vue | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'packages/client/src/components/post-form.vue')

diff --git a/packages/client/src/components/post-form.vue b/packages/client/src/components/post-form.vue
index 6f75e12a77..9bad9a84f8 100644
--- a/packages/client/src/components/post-form.vue
+++ b/packages/client/src/components/post-form.vue
@@ -289,9 +289,14 @@ export default defineComponent({
 
 		if (this.reply && this.reply.text != null) {
 			const ast = mfm.parse(this.reply.text);
+			const otherHost = this.reply.user.host;
 
 			for (const x of extractMentions(ast)) {
-				const mention = x.host ? `@${x.username}@${toASCII(x.host)}` : `@${x.username}`;
+				const mention = x.host ?
+													`@${x.username}@${toASCII(x.host)}` :
+													(otherHost == null || otherHost == host) ?
+														`@${x.username}` :
+														`@${x.username}@${toASCII(otherHost)}`;
 
 				// 自分は除外
 				if (this.$i.username == x.username && x.host == null) continue;
-- 
cgit v1.2.3-freya

