Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
b593b8de
Commit
b593b8de
authored
Apr 11, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1533
Users can only be muted in moderated rooms
parent
76a7c3fa
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
14 deletions
+48
-14
css/converse.css
css/converse.css
+3
-2
dist/converse.js
dist/converse.js
+2
-3
sass/_chatrooms.scss
sass/_chatrooms.scss
+3
-2
spec/muc.js
spec/muc.js
+37
-3
src/converse-muc-views.js
src/converse-muc-views.js
+3
-1
src/headless/converse-chatboxes.js
src/headless/converse-chatboxes.js
+0
-1
src/headless/dist/converse-headless.js
src/headless/dist/converse-headless.js
+0
-2
No files found.
css/converse.css
View file @
b593b8de
...
...
@@ -11683,8 +11683,9 @@ body.converse-fullscreen {
#conversejs
.converse-embedded
.chatroom
.muc-bottom-panel
,
#conversejs
.chatroom
.muc-bottom-panel
{
border-top
:
var
(
--message-input-border-top
);
height
:
4em
;
padding
:
1em
;
height
:
3em
;
padding
:
0.5em
;
text-align
:
center
;
font-size
:
var
(
--font-size-small
);
background-color
:
var
(
--chatroom-head-color
);
color
:
white
;
}
...
...
dist/converse.js
View file @
b593b8de
...
...
@@ -53849,6 +53849,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.model.on('configurationNeeded', this.getAndRenderConfigurationForm, this);
this.model.on('destroy', this.hide, 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('remove', this.onOccupantRemoved, 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() {
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()({
'__': __
});
...
...
@@ -62747,8 +62748,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
} else {
// An error message without id likely means that we
// 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);
}
sass/_chatrooms.scss
View file @
b593b8de
...
...
@@ -308,8 +308,9 @@
.muc-bottom-panel
{
border-top
:
var
(
--
message-input-border-top
);
height
:
4em
;
padding
:
1em
;
height
:
3em
;
padding
:
0
.5em
;
text-align
:
center
;
font-size
:
var
(
--
font-size-small
);
background-color
:
var
(
--
chatroom-head-color
);
color
:
white
;
...
...
spec/muc.js
View file @
b593b8de
...
...
@@ -167,7 +167,7 @@
chatroomview
=
_converse
.
chatboxviews
.
get
(
'
room@conference.example.org
'
);
// 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
'
,
'
id
'
:
IQ_id
,
'
to
'
:
'
dummy@localhost/desktop
'
,
...
...
@@ -184,7 +184,7 @@
* </x>
* </presence>
*/
var
presence
=
$pres
({
const
presence
=
$pres
({
from
:
'
room@conference.example.org/some1
'
,
to
:
'
dummy@localhost/pda
'
})
...
...
@@ -4667,8 +4667,16 @@
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
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
'
);
expect
(
_
.
isNull
(
view
.
el
.
querySelector
(
'
.chat-textarea
'
))).
toBe
(
false
);
let
stanza
=
u
.
toStanza
(
`
<presence
from='trollbox@localhost/troll'
...
...
@@ -4681,6 +4689,25 @@
</x>
</presence>`
);
_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
);
expect
(
info_msgs
.
length
).
toBe
(
4
);
expect
(
info_msgs
[
2
].
textContent
).
toBe
(
"
troll is no longer a moderator
"
);
...
...
@@ -4699,6 +4726,13 @@
</presence>`
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
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
[
4
].
textContent
).
toBe
(
"
troll has been given a voice again
"
);
done
();
...
...
src/converse-muc-views.js
View file @
b593b8de
...
...
@@ -547,6 +547,8 @@ converse.plugins.add('converse-muc-views', {
this
.
model
.
on
(
'
destroy
'
,
this
.
hide
,
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
(
'
remove
'
,
this
.
onOccupantRemoved
,
this
);
this
.
model
.
occupants
.
on
(
'
change:show
'
,
this
.
showJoinOrLeaveNotification
,
this
);
...
...
@@ -601,7 +603,7 @@ converse.plugins.add('converse-muc-views', {
renderBottomPanel
()
{
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
({
'
__
'
:
__
});
}
else
{
if
(
!
container
.
firstElementChild
||
!
container
.
querySelector
(
'
.sendXMPPMessage
'
))
{
...
...
src/headless/converse-chatboxes.js
View file @
b593b8de
...
...
@@ -898,7 +898,6 @@ converse.plugins.add('converse-chatboxes', {
}
else
{
// An error message without id likely means that we
// 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
);
}
const
attrs
=
await
chatbox
.
getMessageAttributesFromStanza
(
message
,
message
);
...
...
src/headless/dist/converse-headless.js
View file @
b593b8de
...
...
@@ -41261,8 +41261,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
} else {
// An error message without id likely means that we
// 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);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment