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
90ef4b0c
Commit
90ef4b0c
authored
Sep 07, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't let non-mods open the modtools modal
Bugfix: fall back to nick if the JID is not available.
parent
768ed4a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
spec/muc.js
spec/muc.js
+2
-2
src/converse-muc-views.js
src/converse-muc-views.js
+9
-5
No files found.
spec/muc.js
View file @
90ef4b0c
...
...
@@ -2987,9 +2987,9 @@
textarea
.
value
=
'
/help
'
;
view
.
onKeyDown
(
enter
);
info_messages
=
sizzle
(
'
.chat-info
'
,
view
.
el
).
slice
(
1
);
expect
(
info_messages
.
length
).
toBe
(
1
0
);
expect
(
info_messages
.
length
).
toBe
(
1
1
);
commands
=
info_messages
.
map
(
m
=>
m
.
textContent
.
replace
(
/:.*$/
,
''
));
expect
(
commands
).
toEqual
([
"
/clear
"
,
"
/help
"
,
"
/kick
"
,
"
/me
"
,
"
/mute
"
,
"
/nick
"
,
"
/register
"
,
"
/subject
"
,
"
/topic
"
,
"
/voice
"
]);
expect
(
commands
).
toEqual
([
"
/clear
"
,
"
/help
"
,
"
/kick
"
,
"
/me
"
,
"
/m
odtools
"
,
"
/m
ute
"
,
"
/nick
"
,
"
/register
"
,
"
/subject
"
,
"
/topic
"
,
"
/voice
"
]);
occupant
.
set
(
'
role
'
,
'
participant
'
);
textarea
.
value
=
'
/clear
'
;
...
...
src/converse-muc-views.js
View file @
90ef4b0c
...
...
@@ -50,8 +50,8 @@ const ROLES = ['moderator', 'participant', 'visitor'];
const
AFFILIATIONS
=
[
'
admin
'
,
'
member
'
,
'
outcast
'
,
'
owner
'
];
const
AFFILIATION_CHANGE_COMANDS
=
[
'
admin
'
,
'
ban
'
,
'
owner
'
,
'
member
'
,
'
revoke
'
];
const
OWNER_COMMANDS
=
[
'
owner
'
];
const
ADMIN_COMMANDS
=
[
'
admin
'
,
'
ban
'
,
'
deop
'
,
'
destroy
'
,
'
m
odtools
'
,
'
m
ember
'
,
'
op
'
,
'
revoke
'
];
const
MODERATOR_COMMANDS
=
[
'
kick
'
,
'
mute
'
,
'
voice
'
];
const
ADMIN_COMMANDS
=
[
'
admin
'
,
'
ban
'
,
'
deop
'
,
'
destroy
'
,
'
member
'
,
'
op
'
,
'
revoke
'
];
const
MODERATOR_COMMANDS
=
[
'
kick
'
,
'
mute
'
,
'
voice
'
,
'
modtools
'
];
const
VISITOR_COMMANDS
=
[
'
nick
'
];
const
COMMAND_TO_ROLE
=
{
...
...
@@ -349,8 +349,7 @@ converse.plugins.add('converse-muc-views', {
ev
.
stopPropagation
();
ev
.
preventDefault
();
const
data
=
new
FormData
(
ev
.
target
);
const
jid
=
data
.
get
(
'
jid
'
);
const
occupant
=
this
.
chatroomview
.
model
.
getOccupant
(
jid
);
const
occupant
=
this
.
chatroomview
.
model
.
getOccupant
(
data
.
get
(
'
jid
'
)
||
data
.
get
(
'
nick
'
));
const
role
=
data
.
get
(
'
role
'
);
const
reason
=
data
.
get
(
'
reason
'
);
const
current_role
=
this
.
model
.
get
(
'
role
'
);
...
...
@@ -365,8 +364,10 @@ converse.plugins.add('converse-muc-views', {
this
.
alert
(
__
(
'
You
\'
re not allowed to make that change
'
),
'
danger
'
);
}
else
{
this
.
alert
(
__
(
'
Sorry, something went wrong while trying to set the role
'
),
'
danger
'
);
if
(
u
.
isErrorObject
(
e
))
{
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
}
}
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
}
);
}
...
...
@@ -762,6 +763,9 @@ converse.plugins.add('converse-muc-views', {
},
showModeratorToolsModal
(
affiliation
)
{
if
(
!
this
.
verifyRoles
([
'
moderator
'
]))
{
return
;
}
if
(
_
.
isUndefined
(
this
.
model
.
modtools_modal
))
{
const
model
=
new
Backbone
.
Model
({
'
affiliation
'
:
affiliation
});
this
.
modtools_modal
=
new
_converse
.
ModeratorToolsModal
({
'
model
'
:
model
,
'
chatroomview
'
:
this
});
...
...
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