mirror of https://github.com/xwiki-labs/cryptpad
Fix mute/unmute button in contacts
This commit is contained in:
parent
64fba3e379
commit
0b248348eb
|
@ -491,15 +491,8 @@ define([
|
|||
};
|
||||
|
||||
var unmuteUser = function (curve) {
|
||||
execCommand('UNMUTE_USER', curve, function (e, data) {
|
||||
execCommand('UNMUTE_USER', curve, function (e) {
|
||||
if (e) { return void console.error(e); }
|
||||
var $button = $('.cp-contacts-muted-user').find('button[data-user="'+curve+'"]');
|
||||
$button.closest('div').remove();
|
||||
if (!data) { $button.hide(); }
|
||||
$('.cp-app-contacts-friend[data-user="'+curve+'"]')
|
||||
.find('.cp-unmute-icon').show();
|
||||
$('.cp-app-contacts-friend[data-user="'+curve+'"]')
|
||||
.find('.cp-mute-icon').show();
|
||||
});
|
||||
};
|
||||
var muteUser = function (data) {
|
||||
|
@ -567,7 +560,7 @@ define([
|
|||
if (friendData.profile) { window.open(origin + '/profile/#' + friendData.profile); }
|
||||
});
|
||||
|
||||
$(unmute).click(function (e) {
|
||||
$(unmute).on('click dblclick', function (e) {
|
||||
e.stopPropagation();
|
||||
var channel = state.channels[id];
|
||||
if (!channel.isFriendChat) { return; }
|
||||
|
@ -577,7 +570,7 @@ define([
|
|||
unmuteUser(curvePublic);
|
||||
});
|
||||
|
||||
$(mute).click(function (e) {
|
||||
$(mute).on('click dblclick', function (e) {
|
||||
e.stopPropagation();
|
||||
var channel = state.channels[id];
|
||||
if (!channel.isFriendChat) { return; }
|
||||
|
@ -863,6 +856,10 @@ define([
|
|||
|
||||
var $button = $userlist.find('.cp-app-contacts-muted-button');
|
||||
|
||||
$('.cp-app-contacts-friend[data-user]')
|
||||
.find('.cp-mute-icon').show();
|
||||
$('.cp-app-contacts-friend[data-user]')
|
||||
.find('.cp-unmute-icon').hide();
|
||||
if (!muted || Object.keys(muted).length === 0) {
|
||||
$button.hide();
|
||||
return;
|
||||
|
@ -871,6 +868,8 @@ define([
|
|||
var rows = Object.keys(muted).map(function (curve) {
|
||||
$('.cp-app-contacts-friend[data-user="'+curve+'"]')
|
||||
.find('.cp-mute-icon').hide();
|
||||
$('.cp-app-contacts-friend[data-user="'+curve+'"]')
|
||||
.find('.cp-unmute-icon').show();
|
||||
var data = muted[curve];
|
||||
var avatar = h('span.cp-avatar');
|
||||
var button = h('button', {
|
||||
|
|
Loading…
Reference in New Issue