Tweak unmute user UX

This commit is contained in:
Noah 2023-06-14 20:45:54 -07:00
parent 4be18ea3a2
commit b767620699
2 changed files with 15 additions and 1 deletions

View File

@ -333,6 +333,11 @@ const app = Vue.createApp({
this.dial(); 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) * Chat API Methods (WebSocket packets sent/received)
*/ */
@ -417,6 +422,7 @@ const app = Vue.createApp({
// Mute or unmute a user. // Mute or unmute a user.
muteUser(username) { muteUser(username) {
username = this.normalizeUsername(username);
let mute = this.muted[username] == undefined; let mute = this.muted[username] == undefined;
if (mute) { if (mute) {
this.muted[username] = true; this.muted[username] = true;
@ -442,7 +448,7 @@ const app = Vue.createApp({
})); }));
}, },
isMutedUser(username) { isMutedUser(username) {
return this.muted[username] != undefined; return this.muted[this.normalizeUsername(username)] != undefined;
}, },
// Send a video request to access a user's camera. // Send a video request to access a user's camera.

View File

@ -853,6 +853,14 @@
</div> </div>
<!-- If this is a DM with a muted user, offer to unmute. -->
<div v-if="isDM && isMutedUser(channel)" class="has-text-danger">
<i class="fa fa-comment-slash"></i>
<strong>[[channel]]</strong> is currently <strong>muted</strong> so you have not been seeing their recent
chat messages or DMs.
<a href="#" v-on:click.prevent="muteUser(channel)">Unmute them?</a>
</div>
</div> </div>
</div> </div>
</div> </div>