comparison roster.js @ 46:af2874ff7234

mathieui: Ask the user for confirmation before deleting PEP nodes or contacts.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 23 May 2020 19:01:23 +0200
parents c2e2b107c7c1
children 010b905a74d4
comparison
equal deleted inserted replaced
45:8b69b3a1ef8e 46:af2874ff7234
53 const button = document.createElementNS('http://www.w3.org/1999/xhtml', 'button'); 53 const button = document.createElementNS('http://www.w3.org/1999/xhtml', 'button');
54 button.classList.add('btn'); 54 button.classList.add('btn');
55 button.classList.add('btn-danger'); 55 button.classList.add('btn-danger');
56 button.textContent = '✕'; 56 button.textContent = '✕';
57 button.onclick = function (evt) { 57 button.onclick = function (evt) {
58 const really = confirm('Do you really want to remove ' + jid + '?');
59 if (!really)
60 return;
58 const iq = $iq({type: 'set'}) 61 const iq = $iq({type: 'set'})
59 .c('query', {xmlns: NS.roster}) 62 .c('query', {xmlns: NS.roster})
60 .c('item', {jid: jid, subscription: 'unsubscribe'}); 63 .c('item', {jid: jid, subscription: 'unsubscribe'});
61 connection.sendIQ(iq, onRosterSet.bind(node), onRosterSetError.bind(node, 'contact removal failed.')); 64 connection.sendIQ(iq, onRosterSet.bind(node), onRosterSetError.bind(node, 'contact removal failed.'));
62 }; 65 };