fixed local users' names showing up twice in mentions

This commit is contained in:
ari melody 2024-06-21 07:47:03 +01:00
parent 2832ed9770
commit b64c5179b8
Signed by: ari
GPG key ID: CF99829C92678188
2 changed files with 4 additions and 3 deletions

View file

@ -148,7 +148,6 @@ export async function parsePost(data, num_replies) {
post.boost_count = data.reblogs_count; post.boost_count = data.reblogs_count;
post.reply_count = data.replies_count; post.reply_count = data.replies_count;
post.mentions = data.mentions; post.mentions = data.mentions;
if (data.media_attachments.length > 0) console.log(data.media_attachments);
post.files = data.media_attachments; post.files = data.media_attachments;
post.url = data.url; post.url = data.url;
post.visibility = data.visibility; post.visibility = data.visibility;
@ -221,7 +220,7 @@ export async function parseUser(data) {
if (data.acct.includes('@')) if (data.acct.includes('@'))
user.host = data.acct.split('@')[1]; user.host = data.acct.split('@')[1];
else else
user.host = data.username + '@' + Client.get().instance.host; user.host = Client.get().instance.host;
user.emojis = []; user.emojis = [];
data.emojis.forEach(emoji_data => { data.emojis.forEach(emoji_data => {

View file

@ -1,3 +1,4 @@
import { Client } from '../client/client.js';
import { parseText as parseEmojis } from '../emoji.js'; import { parseText as parseEmojis } from '../emoji.js';
export default class User { export default class User {
@ -15,7 +16,8 @@ export default class User {
get mention() { get mention() {
let res = "@" + this.username; let res = "@" + this.username;
if (this.host) res += "@" + this.host; if (this.host != Client.get().instance.host)
res += "@" + this.host;
return res; return res;
} }