From c64d33d6959ab5c7941a032d6d17496dd983aaf2 Mon Sep 17 00:00:00 2001 From: vyneer Date: Sun, 8 Sep 2024 15:56:16 +0300 Subject: [PATCH] feat: dont autocomplete ignored users --- assets/chat/js/chat.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/assets/chat/js/chat.js b/assets/chat/js/chat.js index a2121e92..c0f2e020 100644 --- a/assets/chat/js/chat.js +++ b/assets/chat/js/chat.js @@ -1041,9 +1041,10 @@ class Chat { if (data.recipient) { users.push(this.addUser(data.recipient)); } - users.forEach((u) => - this.autocomplete.add(u.displayName, false, Date.now()), - ); + users.forEach((u) => { + if (this.ignored(u.username)) return; + this.autocomplete.add(u.displayName, false, Date.now()); + }); } } @@ -1647,6 +1648,8 @@ class Chat { if (!failure) { validUsernames.forEach((username) => { this.ignore(username, true); + const user = this.users.get(username); + if (user) this.autocomplete.remove(user.displayName, true); }); const resultArray = Array.from(validUsernames.values()); const resultMessage = @@ -1677,6 +1680,8 @@ class Chat { if (!failure) { validUsernames.forEach((username) => { this.ignore(username, false); + const user = this.users.get(username); + if (user) this.autocomplete.add(user.displayName, false, Date.now()); }); const haveOrHas = parts.length === 1 ? 'has' : 'have'; MessageBuilder.status(