Commit e23c7ce5 authored by JC Brand's avatar JC Brand

More retraction updates

- Retracted moderated message are not editable
- Use "removed" for user-facing text
parent 13ffe5a6
{
"name": "converse.js",
"version": "5.0.4",
"version": "6.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -17407,13 +17407,13 @@
"dev": true
},
"twemoji": {
"version": "12.1.3",
"resolved": "https://registry.npmjs.org/twemoji/-/twemoji-12.1.3.tgz",
"integrity": "sha512-Y5mC7vVovHZvCzdXDepJaU6FHPd7PaW6ZTBMWy9sGYafLBn1x0h2T6aGA3cpnz3WgWWg2QI+3D+9Rn4Z/ViitQ==",
"version": "12.1.4",
"resolved": "https://registry.npmjs.org/twemoji/-/twemoji-12.1.4.tgz",
"integrity": "sha512-e37lUlVijmABF7wPCc09s1kKj3hcpzU8KL5zw2bBDIXOtOr4luLF+ODJaEqca8dZPmLR5ezrJYI93nhPovKBiQ==",
"requires": {
"fs-extra": "^8.0.1",
"jsonfile": "^5.0.0",
"twemoji-parser": "12.1.0",
"twemoji-parser": "12.1.1",
"universalify": "^0.1.2"
},
"dependencies": {
......@@ -17429,9 +17429,9 @@
}
},
"twemoji-parser": {
"version": "12.1.0",
"resolved": "https://registry.npmjs.org/twemoji-parser/-/twemoji-parser-12.1.0.tgz",
"integrity": "sha512-jaHYltumP/E8nR+YzRrY753j9dEpL3zH8+pDXgf9h/10wHeW/9IIjs6mZ1Z/Syh8rIaOQObev1BAX/AinFmuOg=="
"version": "12.1.1",
"resolved": "https://registry.npmjs.org/twemoji-parser/-/twemoji-parser-12.1.1.tgz",
"integrity": "sha512-XFUB4ReEvPbNPtiuyo/+crM4RldYbRRAhyE7Hw6EnfBdXECGydw7a49EGADayRvaeierP/m4DSv/OZQObh0LGA=="
},
"type-check": {
"version": "0.3.2",
......
......@@ -265,7 +265,7 @@
expect(message.get('retracted')).toBeTruthy();
expect(view.el.querySelectorAll('.chat-msg--retracted').length).toBe(1);
const msg_el = view.el.querySelector('.chat-msg--retracted .chat-msg__message');
expect(msg_el.textContent.trim()).toBe('Mercutio has retracted this message');
expect(msg_el.textContent.trim()).toBe('Mercutio has removed this message');
expect(u.hasClass('chat-msg--followup', view.el.querySelector('.chat-msg--retracted'))).toBe(true);
done();
}));
......@@ -309,7 +309,7 @@
expect(message.get('retracted')).toBeTruthy();
expect(view.el.querySelectorAll('.chat-msg--retracted').length).toBe(1);
const el = view.el.querySelector('.chat-msg--retracted .chat-msg__message');
expect(el.textContent.trim()).toBe('Romeo Montague has retracted this message');
expect(el.textContent.trim()).toBe('Romeo Montague has removed this message');
done();
}));
});
......@@ -354,7 +354,7 @@
expect(view.model.messages.at(0).get('retracted')).toBeTruthy();
expect(view.el.querySelectorAll('.chat-msg--retracted').length).toBe(1);
const msg_el = view.el.querySelector('.chat-msg--retracted .chat-msg__message');
expect(msg_el.textContent.trim()).toBe('eve has retracted this message');
expect(msg_el.textContent.trim()).toBe('eve has removed this message');
expect(msg_el.querySelector('.chat-msg--retracted q')).toBe(null);
done();
}));
......@@ -421,7 +421,7 @@
expect(view.el.querySelectorAll('.chat-msg--retracted').length).toBe(1);
const msg_el = view.el.querySelector('.chat-msg--retracted .chat-msg__message');
expect(msg_el.firstElementChild.textContent.trim()).toBe('romeo has retracted this message from mallory');
expect(msg_el.firstElementChild.textContent.trim()).toBe('romeo has removed this message');
const qel = msg_el.querySelector('q');
expect(qel.textContent.trim()).toBe('This content is inappropriate for this forum!');
......@@ -522,7 +522,7 @@
expect(view.model.messages.at(0).get('moderated')).toBe('retracted');
expect(view.el.querySelectorAll('.chat-msg--retracted').length).toBe(1);
const msg_el = view.el.querySelector('.chat-msg--retracted .chat-msg__message div');
expect(msg_el.textContent).toBe('romeo has retracted this message from mallory');
expect(msg_el.textContent).toBe('romeo has removed this message');
const qel = view.el.querySelector('.chat-msg--retracted .chat-msg__message q');
expect(qel.textContent).toBe('This content is inappropriate for this forum!');
......@@ -587,7 +587,7 @@
expect(view.model.messages.at(0).get('is_ephemeral')).toBe(false);
expect(view.el.querySelectorAll('.chat-msg--retracted').length).toBe(1);
const el = view.el.querySelector('.chat-msg--retracted .chat-msg__message div');
expect(el.textContent).toBe('romeo has retracted this message');
expect(el.textContent).toBe('romeo has removed this message');
done();
}));
......@@ -609,7 +609,7 @@
expect(view.model.messages.length).toBe(1);
expect(view.model.messages.at(0).get('retracted')).toBeTruthy();
const el = view.el.querySelector('.chat-msg--retracted .chat-msg__message div');
expect(el.textContent.trim()).toBe('romeo has retracted this message');
expect(el.textContent.trim()).toBe('romeo has removed this message');
const message = view.model.messages.at(0);
const stanza_id = message.get(`stanza_id ${view.model.get('jid')}`);
......@@ -660,7 +660,7 @@
expect(view.model.messages.length).toBe(1);
expect(view.model.messages.at(0).get('retracted')).toBeTruthy();
const el = view.el.querySelector('.chat-msg--retracted .chat-msg__message div');
expect(el.textContent.trim()).toBe('romeo has retracted this message');
expect(el.textContent.trim()).toBe('romeo has removed this message');
await u.waitUntil(() => view.el.querySelectorAll('.chat-msg').length === 1);
......@@ -763,7 +763,7 @@
expect(view.el.querySelectorAll('.chat-msg').length).toBe(2);
expect(view.el.querySelectorAll('.chat-msg--retracted').length).toBe(1);
const el = view.el.querySelector('.chat-msg--retracted .chat-msg__message div');
expect(el.textContent.trim()).toBe('Mercutio has retracted this message');
expect(el.textContent.trim()).toBe('Mercutio has removed this message');
expect(u.hasClass('chat-msg--followup', el.parentElement)).toBe(false);
done();
}));
......@@ -841,7 +841,7 @@
expect(view.el.querySelectorAll('.chat-msg').length).toBe(1);
expect(view.el.querySelectorAll('.chat-msg--retracted').length).toBe(1);
const el = view.el.querySelector('.chat-msg--retracted .chat-msg__message div');
expect(el.textContent.trim()).toBe('eve has retracted this message');
expect(el.textContent.trim()).toBe('eve has removed this message');
done();
}));
......@@ -926,7 +926,7 @@
expect(view.el.querySelectorAll('.chat-msg--retracted').length).toBe(1);
const el = view.el.querySelector('.chat-msg--retracted .chat-msg__message div');
expect(el.textContent.trim()).toBe('A moderator has retracted this message from eve');
expect(el.textContent.trim()).toBe('A moderator has removed this message');
const qel = view.el.querySelector('.chat-msg--retracted .chat-msg__message q');
expect(qel.textContent.trim()).toBe('This message contains inappropriate content');
done();
......
......@@ -315,9 +315,9 @@ converse.plugins.add('converse-message-view', {
chatbox.occupants.findOccupant({'nick': Strophe.getResourceFromJid(retracted_by_mod)});
}
const modname = this.model.mod ? this.model.mod.getDisplayName() : 'A moderator';
return __('%1$s has retracted this message', modname);
return __('%1$s has removed this message', modname);
} else {
return __('%1$s has retracted this message', this.model.getDisplayName());
return __('%1$s has removed this message', this.model.getDisplayName());
}
},
......
......@@ -1621,6 +1621,7 @@ converse.plugins.add('converse-muc', {
*/
handleModeration (attrs) {
const MODERATION_ATTRIBUTES = [
'editable',
'moderated',
'moderated_by',
'moderated_id',
......
......@@ -88,6 +88,7 @@ const stanza_utils = {
return {};
}
return {
'edtiable': false,
'moderated': 'retracted',
'moderated_by': moderated.getAttribute('by'),
'moderated_id': applies_to_id,
......@@ -101,9 +102,10 @@ const stanza_utils = {
const retracted = sizzle(`retracted[xmlns="${Strophe.NS.RETRACT}"]`, tombstone).pop();
if (retracted) {
return {
'edtiable': false,
'is_tombstone': true,
'retracted': tombstone.getAttribute('stamp'),
'moderated_by': tombstone.getAttribute('by'),
'retracted': tombstone.getAttribute('stamp'),
'moderation_reason': get(tombstone.querySelector('reason'), 'textContent')
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment