parent
76a7c3fa9b
commit
b593b8deb6
@ -11683,8 +11683,9 @@ body.converse-fullscreen {
|
|||||||
#conversejs.converse-embedded .chatroom .muc-bottom-panel,
|
#conversejs.converse-embedded .chatroom .muc-bottom-panel,
|
||||||
#conversejs .chatroom .muc-bottom-panel {
|
#conversejs .chatroom .muc-bottom-panel {
|
||||||
border-top: var(--message-input-border-top);
|
border-top: var(--message-input-border-top);
|
||||||
height: 4em;
|
height: 3em;
|
||||||
padding: 1em;
|
padding: 0.5em;
|
||||||
|
text-align: center;
|
||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
background-color: var(--chatroom-head-color);
|
background-color: var(--chatroom-head-color);
|
||||||
color: white; }
|
color: white; }
|
||||||
|
5
dist/converse.js
vendored
5
dist/converse.js
vendored
@ -53849,6 +53849,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
|
|||||||
this.model.on('configurationNeeded', this.getAndRenderConfigurationForm, this);
|
this.model.on('configurationNeeded', this.getAndRenderConfigurationForm, this);
|
||||||
this.model.on('destroy', this.hide, this);
|
this.model.on('destroy', this.hide, this);
|
||||||
this.model.on('show', this.show, this);
|
this.model.on('show', this.show, this);
|
||||||
|
this.model.features.on('change:moderated', this.renderBottomPanel, this);
|
||||||
this.model.occupants.on('add', this.onOccupantAdded, this);
|
this.model.occupants.on('add', this.onOccupantAdded, this);
|
||||||
this.model.occupants.on('remove', this.onOccupantRemoved, this);
|
this.model.occupants.on('remove', this.onOccupantRemoved, this);
|
||||||
this.model.occupants.on('change:show', this.showJoinOrLeaveNotification, this);
|
this.model.occupants.on('change:show', this.showJoinOrLeaveNotification, this);
|
||||||
@ -53912,7 +53913,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
|
|||||||
renderBottomPanel() {
|
renderBottomPanel() {
|
||||||
const container = this.el.querySelector('.bottom-panel');
|
const container = this.el.querySelector('.bottom-panel');
|
||||||
|
|
||||||
if (this.model.get('role') === 'visitor') {
|
if (this.model.features.get('moderated') && this.model.get('role') === 'visitor') {
|
||||||
container.innerHTML = templates_chatroom_bottom_panel_html__WEBPACK_IMPORTED_MODULE_10___default()({
|
container.innerHTML = templates_chatroom_bottom_panel_html__WEBPACK_IMPORTED_MODULE_10___default()({
|
||||||
'__': __
|
'__': __
|
||||||
});
|
});
|
||||||
@ -62747,8 +62748,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
|
|||||||
} else {
|
} else {
|
||||||
// An error message without id likely means that we
|
// An error message without id likely means that we
|
||||||
// sent a message without id (which shouldn't happen).
|
// sent a message without id (which shouldn't happen).
|
||||||
_converse.log('Received an error message without id attribute!', Strophe.LogLevel.ERROR);
|
|
||||||
|
|
||||||
_converse.log(message, Strophe.LogLevel.ERROR);
|
_converse.log(message, Strophe.LogLevel.ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,8 +308,9 @@
|
|||||||
|
|
||||||
.muc-bottom-panel {
|
.muc-bottom-panel {
|
||||||
border-top: var(--message-input-border-top);
|
border-top: var(--message-input-border-top);
|
||||||
height: 4em;
|
height: 3em;
|
||||||
padding: 1em;
|
padding: 0.5em;
|
||||||
|
text-align: center;
|
||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
background-color: var(--chatroom-head-color);
|
background-color: var(--chatroom-head-color);
|
||||||
color: white;
|
color: white;
|
||||||
|
40
spec/muc.js
40
spec/muc.js
@ -167,7 +167,7 @@
|
|||||||
chatroomview = _converse.chatboxviews.get('room@conference.example.org');
|
chatroomview = _converse.chatboxviews.get('room@conference.example.org');
|
||||||
|
|
||||||
// We pretend this is a new room, so no disco info is returned.
|
// We pretend this is a new room, so no disco info is returned.
|
||||||
var features_stanza = $iq({
|
const features_stanza = $iq({
|
||||||
from: 'room@conference.example.org',
|
from: 'room@conference.example.org',
|
||||||
'id': IQ_id,
|
'id': IQ_id,
|
||||||
'to': 'dummy@localhost/desktop',
|
'to': 'dummy@localhost/desktop',
|
||||||
@ -184,7 +184,7 @@
|
|||||||
* </x>
|
* </x>
|
||||||
* </presence>
|
* </presence>
|
||||||
*/
|
*/
|
||||||
var presence = $pres({
|
const presence = $pres({
|
||||||
from:'room@conference.example.org/some1',
|
from:'room@conference.example.org/some1',
|
||||||
to:'dummy@localhost/pda'
|
to:'dummy@localhost/pda'
|
||||||
})
|
})
|
||||||
@ -4667,8 +4667,16 @@
|
|||||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
|
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
|
||||||
async function (done, _converse) {
|
async function (done, _converse) {
|
||||||
|
|
||||||
await test_utils.openAndEnterChatRoom(_converse, 'trollbox', 'localhost', 'troll');
|
const features = [
|
||||||
|
'http://jabber.org/protocol/muc',
|
||||||
|
'jabber:iq:register',
|
||||||
|
Strophe.NS.SID,
|
||||||
|
'muc_moderated',
|
||||||
|
]
|
||||||
|
await test_utils.openAndEnterChatRoom(_converse, 'trollbox', 'localhost', 'troll', features);
|
||||||
const view = _converse.chatboxviews.get('trollbox@localhost');
|
const view = _converse.chatboxviews.get('trollbox@localhost');
|
||||||
|
expect(_.isNull(view.el.querySelector('.chat-textarea'))).toBe(false);
|
||||||
|
|
||||||
let stanza = u.toStanza(`
|
let stanza = u.toStanza(`
|
||||||
<presence
|
<presence
|
||||||
from='trollbox@localhost/troll'
|
from='trollbox@localhost/troll'
|
||||||
@ -4681,6 +4689,25 @@
|
|||||||
</x>
|
</x>
|
||||||
</presence>`);
|
</presence>`);
|
||||||
_converse.connection._dataRecv(test_utils.createRequest(stanza));
|
_converse.connection._dataRecv(test_utils.createRequest(stanza));
|
||||||
|
|
||||||
|
expect(view.el.querySelector('.chat-textarea')).toBe(null);
|
||||||
|
let bottom_panel = view.el.querySelector('.muc-bottom-panel');
|
||||||
|
expect(bottom_panel.textContent.trim()).toBe("You're not allowed to send messages in this room");
|
||||||
|
|
||||||
|
// This only applies to moderated rooms, so let's check that
|
||||||
|
// the textarea becomes visible when the room's
|
||||||
|
// configuration changes to be non-moderated
|
||||||
|
view.model.features.set('moderated', false);
|
||||||
|
expect(view.el.querySelector('.muc-bottom-panel')).toBe(null);
|
||||||
|
let textarea = view.el.querySelector('.chat-textarea');
|
||||||
|
expect(_.isNull(textarea)).toBe(false);
|
||||||
|
|
||||||
|
view.model.features.set('moderated', true);
|
||||||
|
expect(view.el.querySelector('.chat-textarea')).toBe(null);
|
||||||
|
bottom_panel = view.el.querySelector('.muc-bottom-panel');
|
||||||
|
expect(bottom_panel.textContent.trim()).toBe("You're not allowed to send messages in this room");
|
||||||
|
|
||||||
|
// Check now that things get restored when the user is given a voice
|
||||||
let info_msgs = sizzle('.chat-info', view.el);
|
let info_msgs = sizzle('.chat-info', view.el);
|
||||||
expect(info_msgs.length).toBe(4);
|
expect(info_msgs.length).toBe(4);
|
||||||
expect(info_msgs[2].textContent).toBe("troll is no longer a moderator");
|
expect(info_msgs[2].textContent).toBe("troll is no longer a moderator");
|
||||||
@ -4699,6 +4726,13 @@
|
|||||||
</presence>`);
|
</presence>`);
|
||||||
_converse.connection._dataRecv(test_utils.createRequest(stanza));
|
_converse.connection._dataRecv(test_utils.createRequest(stanza));
|
||||||
info_msgs = sizzle('.chat-info', view.el);
|
info_msgs = sizzle('.chat-info', view.el);
|
||||||
|
|
||||||
|
bottom_panel = view.el.querySelector('.muc-bottom-panel');
|
||||||
|
expect(bottom_panel).toBe(null);
|
||||||
|
|
||||||
|
textarea = view.el.querySelector('.chat-textarea');
|
||||||
|
expect(_.isNull(textarea)).toBe(false);
|
||||||
|
|
||||||
expect(info_msgs.length).toBe(5);
|
expect(info_msgs.length).toBe(5);
|
||||||
expect(info_msgs[4].textContent).toBe("troll has been given a voice again");
|
expect(info_msgs[4].textContent).toBe("troll has been given a voice again");
|
||||||
done();
|
done();
|
||||||
|
@ -547,6 +547,8 @@ converse.plugins.add('converse-muc-views', {
|
|||||||
this.model.on('destroy', this.hide, this);
|
this.model.on('destroy', this.hide, this);
|
||||||
this.model.on('show', this.show, this);
|
this.model.on('show', this.show, this);
|
||||||
|
|
||||||
|
this.model.features.on('change:moderated', this.renderBottomPanel, this);
|
||||||
|
|
||||||
this.model.occupants.on('add', this.onOccupantAdded, this);
|
this.model.occupants.on('add', this.onOccupantAdded, this);
|
||||||
this.model.occupants.on('remove', this.onOccupantRemoved, this);
|
this.model.occupants.on('remove', this.onOccupantRemoved, this);
|
||||||
this.model.occupants.on('change:show', this.showJoinOrLeaveNotification, this);
|
this.model.occupants.on('change:show', this.showJoinOrLeaveNotification, this);
|
||||||
@ -601,7 +603,7 @@ converse.plugins.add('converse-muc-views', {
|
|||||||
|
|
||||||
renderBottomPanel () {
|
renderBottomPanel () {
|
||||||
const container = this.el.querySelector('.bottom-panel');
|
const container = this.el.querySelector('.bottom-panel');
|
||||||
if (this.model.get('role') === 'visitor') {
|
if (this.model.features.get('moderated') && this.model.get('role') === 'visitor') {
|
||||||
container.innerHTML = tpl_chatroom_bottom_panel({'__': __});
|
container.innerHTML = tpl_chatroom_bottom_panel({'__': __});
|
||||||
} else {
|
} else {
|
||||||
if (!container.firstElementChild || !container.querySelector('.sendXMPPMessage')) {
|
if (!container.firstElementChild || !container.querySelector('.sendXMPPMessage')) {
|
||||||
|
@ -898,7 +898,6 @@ converse.plugins.add('converse-chatboxes', {
|
|||||||
} else {
|
} else {
|
||||||
// An error message without id likely means that we
|
// An error message without id likely means that we
|
||||||
// sent a message without id (which shouldn't happen).
|
// sent a message without id (which shouldn't happen).
|
||||||
_converse.log('Received an error message without id attribute!', Strophe.LogLevel.ERROR);
|
|
||||||
_converse.log(message, Strophe.LogLevel.ERROR);
|
_converse.log(message, Strophe.LogLevel.ERROR);
|
||||||
}
|
}
|
||||||
const attrs = await chatbox.getMessageAttributesFromStanza(message, message);
|
const attrs = await chatbox.getMessageAttributesFromStanza(message, message);
|
||||||
|
2
src/headless/dist/converse-headless.js
vendored
2
src/headless/dist/converse-headless.js
vendored
@ -41261,8 +41261,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
|
|||||||
} else {
|
} else {
|
||||||
// An error message without id likely means that we
|
// An error message without id likely means that we
|
||||||
// sent a message without id (which shouldn't happen).
|
// sent a message without id (which shouldn't happen).
|
||||||
_converse.log('Received an error message without id attribute!', Strophe.LogLevel.ERROR);
|
|
||||||
|
|
||||||
_converse.log(message, Strophe.LogLevel.ERROR);
|
_converse.log(message, Strophe.LogLevel.ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user