From b76762069941cfb3a9c88dec6bcd658cc9f97118 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Wed, 14 Jun 2023 20:45:54 -0700 Subject: [PATCH] Tweak unmute user UX --- web/static/js/BareRTC.js | 8 +++++++- web/templates/chat.html | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/web/static/js/BareRTC.js b/web/static/js/BareRTC.js index 5fd47ed..5d654a5 100644 --- a/web/static/js/BareRTC.js +++ b/web/static/js/BareRTC.js @@ -333,6 +333,11 @@ const app = Vue.createApp({ this.dial(); }, + // Normalize a DM channel name into a username (remove the @ prefix) + normalizeUsername(channel) { + return channel.replace(/^@+/, ''); + }, + /** * Chat API Methods (WebSocket packets sent/received) */ @@ -417,6 +422,7 @@ const app = Vue.createApp({ // Mute or unmute a user. muteUser(username) { + username = this.normalizeUsername(username); let mute = this.muted[username] == undefined; if (mute) { this.muted[username] = true; @@ -442,7 +448,7 @@ const app = Vue.createApp({ })); }, isMutedUser(username) { - return this.muted[username] != undefined; + return this.muted[this.normalizeUsername(username)] != undefined; }, // Send a video request to access a user's camera. diff --git a/web/templates/chat.html b/web/templates/chat.html index 5736e3d..37a7218 100644 --- a/web/templates/chat.html +++ b/web/templates/chat.html @@ -853,6 +853,14 @@ + +
+ + [[channel]] is currently muted so you have not been seeing their recent + chat messages or DMs. + Unmute them? +
+