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
32f0eb54
Commit
32f0eb54
authored
Mar 26, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1407. Don't allow empty value for MUC nickname
parent
275ad40f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
24 deletions
+37
-24
CHANGES.md
CHANGES.md
+1
-0
dist/converse.js
dist/converse.js
+11
-10
spec/muc.js
spec/muc.js
+13
-3
src/converse-muc-views.js
src/converse-muc-views.js
+4
-5
src/templates/add_chatroom_modal.html
src/templates/add_chatroom_modal.html
+5
-5
tests/utils.js
tests/utils.js
+3
-1
No files found.
CHANGES.md
View file @
32f0eb54
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
-
#1352: Add
[
Jed
](
https://github.com/messageformat/Jed
)
as dependency of
`@converse/headless`
-
#1352: Add
[
Jed
](
https://github.com/messageformat/Jed
)
as dependency of
`@converse/headless`
-
#1373: Re-add support for the
[
muc_domain
](
https://conversejs.org/docs/html/configuration.html#muc-domain
)
setting
-
#1373: Re-add support for the
[
muc_domain
](
https://conversejs.org/docs/html/configuration.html#muc-domain
)
setting
-
#1400: When a chat message is just an emoji, enlarge the emoji
-
#1400: When a chat message is just an emoji, enlarge the emoji
-
#1407: Silent errors when trying to use whitespace as MUC nickname
-
#1437: List of groupchats in modal doesn't scroll
-
#1437: List of groupchats in modal doesn't scroll
-
#1457: Wrong tooltip shown for "unbookmark" icon
-
#1457: Wrong tooltip shown for "unbookmark" icon
-
#1479: Allow file upload by drag & drop also in MUCs
-
#1479: Allow file upload by drag & drop also in MUCs
...
...
dist/converse.js
View file @
32f0eb54
...
@@ -54112,11 +54112,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins
...
@@ -54112,11 +54112,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins
}
}
return templates_add_chatroom_modal_html__WEBPACK_IMPORTED_MODULE_8___default()(_.extend(this.model.toJSON(), {
return templates_add_chatroom_modal_html__WEBPACK_IMPORTED_MODULE_8___default()(_.extend(this.model.toJSON(), {
'heading_new_chatroom': __('Enter a new Groupchat'),
'__': _converse.__,
'_converse': _converse,
'label_room_address': _converse.muc_domain ? __('Groupchat name') : __('Groupchat address'),
'label_room_address': _converse.muc_domain ? __('Groupchat name') : __('Groupchat address'),
'label_nickname': __('Optional nickname'),
'chatroom_placeholder': placeholder
'chatroom_placeholder': placeholder,
'label_join': __('Join')
}));
}));
},
},
...
@@ -54132,7 +54131,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins
...
@@ -54132,7 +54131,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins
this.model.save('muc_domain', Strophe.getDomainFromJid(jid));
this.model.save('muc_domain', Strophe.getDomainFromJid(jid));
return {
return {
'jid': jid,
'jid': jid,
'nick': data.get('nickname')
'nick': data.get('nickname')
.trim()
};
};
},
},
...
@@ -92537,17 +92536,19 @@ var _ = {escape:__webpack_require__(/*! ./node_modules/lodash/escape.js */ "./no
...
@@ -92537,17 +92536,19 @@ var _ = {escape:__webpack_require__(/*! ./node_modules/lodash/escape.js */ "./no
module.exports = function(o) {
module.exports = function(o) {
var __t, __p = '', __e = _.escape;
var __t, __p = '', __e = _.escape;
__p += '<!-- src/templates/add_chatroom_modal.html -->\n<div class="modal fade" id="add-chatroom-modal" tabindex="-1" role="dialog" aria-labelledby="add-chatroom-modal-label" aria-hidden="true">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title"\n id="add-chatroom-modal-label">' +
__p += '<!-- src/templates/add_chatroom_modal.html -->\n<div class="modal fade" id="add-chatroom-modal" tabindex="-1" role="dialog" aria-labelledby="add-chatroom-modal-label" aria-hidden="true">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title"\n id="add-chatroom-modal-label">' +
__e(o.
heading_new_chatroom
) +
__e(o.
__('Enter a new Groupchat')
) +
'</h5>\n <button type="button" class="close" data-dismiss="modal" aria-label="Close">\n <span aria-hidden="true">×</span>\n </button>\n </div>\n <div class="modal-body">\n <form class="converse-form add-chatroom">\n <div class="form-group">\n <label for="chatroom">' +
'</h5>\n <button type="button" class="close" data-dismiss="modal" aria-label="Close">\n <span aria-hidden="true">×</span>\n </button>\n </div>\n <div class="modal-body">\n <form class="converse-form add-chatroom">\n <div class="form-group">\n <label for="chatroom">' +
__e(o.label_room_address) +
__e(o.label_room_address) +
':</label>\n <input type="text" required="required" name="chatroom" class="form-control" placeholder="' +
':</label>\n <input type="text" required="required" name="chatroom" class="form-control" placeholder="' +
__e(o.chatroom_placeholder) +
__e(o.chatroom_placeholder) +
'"/>\n </div>\n <div class="form-group">\n <label for="nickname">' +
'"/>\n </div>\n <div class="form-group" >\n <label for="nickname">' +
__e(o.label_nickname) +
__e(o.__('Nickname')) +
':</label>\n <input type="text" name="nickname" value="' +
':</label>\n <input type="text" pattern=".*\\S+.*" title="' +
__e(o.__('This field is required')) +
'" required="required" name="nickname" value="' +
__e(o.nick) +
__e(o.nick) +
'" class="form-control"/>\n </div>\n <input type="submit" class="btn btn-primary" name="join" value="' +
'" class="form-control"/>\n </div>\n <input type="submit" class="btn btn-primary" name="join" value="' +
__e(o.
label_join
) +
__e(o.
__('Join')
) +
'"/>\n </form>\n </div>\n </div>\n </div>\n</div>\n';
'"/>\n </form>\n </div>\n </div>\n </div>\n</div>\n';
return __p
return __p
};
};
spec/muc.js
View file @
32f0eb54
...
@@ -3972,9 +3972,10 @@
...
@@ -3972,9 +3972,10 @@
expect
(
name_input
.
placeholder
).
toBe
(
'
name@conference.example.org
'
);
expect
(
name_input
.
placeholder
).
toBe
(
'
name@conference.example.org
'
);
const
label_nick
=
modal
.
el
.
querySelector
(
'
label[for="nickname"]
'
);
const
label_nick
=
modal
.
el
.
querySelector
(
'
label[for="nickname"]
'
);
expect
(
label_nick
.
textContent
).
toBe
(
'
Optional n
ickname:
'
);
expect
(
label_nick
.
textContent
).
toBe
(
'
N
ickname:
'
);
const
nick_input
=
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
);
const
nick_input
=
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
);
expect
(
nick_input
.
value
).
toBe
(
''
);
expect
(
nick_input
.
value
).
toBe
(
''
);
nick_input
.
value
=
'
dummy
'
;
expect
(
modal
.
el
.
querySelector
(
'
.modal-title
'
).
textContent
).
toBe
(
'
Enter a new Groupchat
'
);
expect
(
modal
.
el
.
querySelector
(
'
.modal-title
'
).
textContent
).
toBe
(
'
Enter a new Groupchat
'
);
spyOn
(
_converse
.
ChatRoom
.
prototype
,
'
getRoomFeatures
'
).
and
.
callFake
(()
=>
Promise
.
resolve
());
spyOn
(
_converse
.
ChatRoom
.
prototype
,
'
getRoomFeatures
'
).
and
.
callFake
(()
=>
Promise
.
resolve
());
...
@@ -4006,7 +4007,7 @@
...
@@ -4006,7 +4007,7 @@
const
modal
=
roomspanel
.
add_room_modal
;
const
modal
=
roomspanel
.
add_room_modal
;
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
)
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
)
const
label_nick
=
modal
.
el
.
querySelector
(
'
label[for="nickname"]
'
);
const
label_nick
=
modal
.
el
.
querySelector
(
'
label[for="nickname"]
'
);
expect
(
label_nick
.
textContent
).
toBe
(
'
Optional n
ickname:
'
);
expect
(
label_nick
.
textContent
).
toBe
(
'
N
ickname:
'
);
const
nick_input
=
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
);
const
nick_input
=
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
);
expect
(
nick_input
.
value
).
toBe
(
'
dummy
'
);
expect
(
nick_input
.
value
).
toBe
(
'
dummy
'
);
done
();
done
();
...
@@ -4026,7 +4027,7 @@
...
@@ -4026,7 +4027,7 @@
const
modal
=
roomspanel
.
add_room_modal
;
const
modal
=
roomspanel
.
add_room_modal
;
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
)
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
)
const
label_nick
=
modal
.
el
.
querySelector
(
'
label[for="nickname"]
'
);
const
label_nick
=
modal
.
el
.
querySelector
(
'
label[for="nickname"]
'
);
expect
(
label_nick
.
textContent
).
toBe
(
'
Optional n
ickname:
'
);
expect
(
label_nick
.
textContent
).
toBe
(
'
N
ickname:
'
);
const
nick_input
=
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
);
const
nick_input
=
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
);
expect
(
nick_input
.
value
).
toBe
(
'
st.nick
'
);
expect
(
nick_input
.
value
).
toBe
(
'
st.nick
'
);
done
();
done
();
...
@@ -4050,6 +4051,9 @@
...
@@ -4050,6 +4051,9 @@
let
name_input
=
modal
.
el
.
querySelector
(
'
input[name="chatroom"]
'
);
let
name_input
=
modal
.
el
.
querySelector
(
'
input[name="chatroom"]
'
);
expect
(
name_input
.
placeholder
).
toBe
(
'
name@muc.example.org
'
);
expect
(
name_input
.
placeholder
).
toBe
(
'
name@muc.example.org
'
);
name_input
.
value
=
'
lounge
'
;
name_input
.
value
=
'
lounge
'
;
let
nick_input
=
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
);
nick_input
.
value
=
'
max
'
;
modal
.
el
.
querySelector
(
'
form input[type="submit"]
'
).
click
();
modal
.
el
.
querySelector
(
'
form input[type="submit"]
'
).
click
();
await
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxes
.
length
);
await
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxes
.
length
);
await
test_utils
.
waitUntil
(()
=>
sizzle
(
'
.chatroom
'
,
_converse
.
el
).
filter
(
u
.
isVisible
).
length
===
1
);
await
test_utils
.
waitUntil
(()
=>
sizzle
(
'
.chatroom
'
,
_converse
.
el
).
filter
(
u
.
isVisible
).
length
===
1
);
...
@@ -4060,6 +4064,8 @@
...
@@ -4060,6 +4064,8 @@
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
);
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
);
name_input
=
modal
.
el
.
querySelector
(
'
input[name="chatroom"]
'
);
name_input
=
modal
.
el
.
querySelector
(
'
input[name="chatroom"]
'
);
name_input
.
value
=
'
lounge@conference.example.org
'
;
name_input
.
value
=
'
lounge@conference.example.org
'
;
nick_input
=
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
);
nick_input
.
value
=
'
max
'
;
modal
.
el
.
querySelector
(
'
form input[type="submit"]
'
).
click
();
modal
.
el
.
querySelector
(
'
form input[type="submit"]
'
).
click
();
await
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxes
.
models
.
filter
(
c
=>
c
.
get
(
'
type
'
)
===
'
chatroom
'
).
length
===
2
);
await
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxes
.
models
.
filter
(
c
=>
c
.
get
(
'
type
'
)
===
'
chatroom
'
).
length
===
2
);
await
test_utils
.
waitUntil
(()
=>
sizzle
(
'
.chatroom
'
,
_converse
.
el
).
filter
(
u
.
isVisible
).
length
===
2
);
await
test_utils
.
waitUntil
(()
=>
sizzle
(
'
.chatroom
'
,
_converse
.
el
).
filter
(
u
.
isVisible
).
length
===
2
);
...
@@ -4085,6 +4091,8 @@
...
@@ -4085,6 +4091,8 @@
let
name_input
=
modal
.
el
.
querySelector
(
'
input[name="chatroom"]
'
);
let
name_input
=
modal
.
el
.
querySelector
(
'
input[name="chatroom"]
'
);
expect
(
name_input
.
placeholder
).
toBe
(
''
);
expect
(
name_input
.
placeholder
).
toBe
(
''
);
name_input
.
value
=
'
lounge
'
;
name_input
.
value
=
'
lounge
'
;
let
nick_input
=
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
);
nick_input
.
value
=
'
max
'
;
modal
.
el
.
querySelector
(
'
form input[type="submit"]
'
).
click
();
modal
.
el
.
querySelector
(
'
form input[type="submit"]
'
).
click
();
await
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxes
.
length
);
await
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxes
.
length
);
await
test_utils
.
waitUntil
(()
=>
sizzle
(
'
.chatroom
'
,
_converse
.
el
).
filter
(
u
.
isVisible
).
length
===
1
);
await
test_utils
.
waitUntil
(()
=>
sizzle
(
'
.chatroom
'
,
_converse
.
el
).
filter
(
u
.
isVisible
).
length
===
1
);
...
@@ -4095,6 +4103,8 @@
...
@@ -4095,6 +4103,8 @@
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
);
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
);
name_input
=
modal
.
el
.
querySelector
(
'
input[name="chatroom"]
'
);
name_input
=
modal
.
el
.
querySelector
(
'
input[name="chatroom"]
'
);
name_input
.
value
=
'
lounge@conference
'
;
name_input
.
value
=
'
lounge@conference
'
;
nick_input
=
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
);
nick_input
.
value
=
'
max
'
;
modal
.
el
.
querySelector
(
'
form input[type="submit"]
'
).
click
();
modal
.
el
.
querySelector
(
'
form input[type="submit"]
'
).
click
();
await
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxes
.
models
.
filter
(
c
=>
c
.
get
(
'
type
'
)
===
'
chatroom
'
).
length
===
2
);
await
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxes
.
models
.
filter
(
c
=>
c
.
get
(
'
type
'
)
===
'
chatroom
'
).
length
===
2
);
await
test_utils
.
waitUntil
(()
=>
sizzle
(
'
.chatroom
'
,
_converse
.
el
).
filter
(
u
.
isVisible
).
length
===
2
);
await
test_utils
.
waitUntil
(()
=>
sizzle
(
'
.chatroom
'
,
_converse
.
el
).
filter
(
u
.
isVisible
).
length
===
2
);
...
...
src/converse-muc-views.js
View file @
32f0eb54
...
@@ -412,11 +412,10 @@ converse.plugins.add('converse-muc-views', {
...
@@ -412,11 +412,10 @@ converse.plugins.add('converse-muc-views', {
placeholder
=
muc_domain
?
`name@
${
muc_domain
}
`
:
__
(
'
name@conference.example.org
'
);
placeholder
=
muc_domain
?
`name@
${
muc_domain
}
`
:
__
(
'
name@conference.example.org
'
);
}
}
return
tpl_add_chatroom_modal
(
_
.
extend
(
this
.
model
.
toJSON
(),
{
return
tpl_add_chatroom_modal
(
_
.
extend
(
this
.
model
.
toJSON
(),
{
'
heading_new_chatroom
'
:
__
(
'
Enter a new Groupchat
'
),
'
__
'
:
_converse
.
__
,
'
_converse
'
:
_converse
,
'
label_room_address
'
:
_converse
.
muc_domain
?
__
(
'
Groupchat name
'
)
:
__
(
'
Groupchat address
'
),
'
label_room_address
'
:
_converse
.
muc_domain
?
__
(
'
Groupchat name
'
)
:
__
(
'
Groupchat address
'
),
'
label_nickname
'
:
__
(
'
Optional nickname
'
),
'
chatroom_placeholder
'
:
placeholder
'
chatroom_placeholder
'
:
placeholder
,
'
label_join
'
:
__
(
'
Join
'
),
}));
}));
},
},
...
@@ -432,7 +431,7 @@ converse.plugins.add('converse-muc-views', {
...
@@ -432,7 +431,7 @@ converse.plugins.add('converse-muc-views', {
this
.
model
.
save
(
'
muc_domain
'
,
Strophe
.
getDomainFromJid
(
jid
));
this
.
model
.
save
(
'
muc_domain
'
,
Strophe
.
getDomainFromJid
(
jid
));
return
{
return
{
'
jid
'
:
jid
,
'
jid
'
:
jid
,
'
nick
'
:
data
.
get
(
'
nickname
'
)
'
nick
'
:
data
.
get
(
'
nickname
'
)
.
trim
()
}
}
},
},
...
...
src/templates/add_chatroom_modal.html
View file @
32f0eb54
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<div
class=
"modal-content"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<div
class=
"modal-header"
>
<h5
class=
"modal-title"
<h5
class=
"modal-title"
id=
"add-chatroom-modal-label"
>
{{{o.
heading_new_chatroom
}}}
</h5>
id=
"add-chatroom-modal-label"
>
{{{o.
__('Enter a new Groupchat')
}}}
</h5>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</button>
...
@@ -14,11 +14,11 @@
...
@@ -14,11 +14,11 @@
<label
for=
"chatroom"
>
{{{o.label_room_address}}}:
</label>
<label
for=
"chatroom"
>
{{{o.label_room_address}}}:
</label>
<input
type=
"text"
required=
"required"
name=
"chatroom"
class=
"form-control"
placeholder=
"{{{o.chatroom_placeholder}}}"
/>
<input
type=
"text"
required=
"required"
name=
"chatroom"
class=
"form-control"
placeholder=
"{{{o.chatroom_placeholder}}}"
/>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"nickname"
>
{{{o.
label_nickname
}}}:
</label>
<label
for=
"nickname"
>
{{{o.
__('Nickname')
}}}:
</label>
<input
type=
"text"
name=
"nickname"
value=
"{{{o.nick}}}"
class=
"form-control"
/>
<input
type=
"text"
pattern=
".*\S+.*"
title=
"{{{o.__('This field is required')}}}"
required=
"required"
name=
"nickname"
value=
"{{{o.nick}}}"
class=
"form-control"
/>
</div>
</div>
<input
type=
"submit"
class=
"btn btn-primary"
name=
"join"
value=
"{{{o.
label_join
}}}"
/>
<input
type=
"submit"
class=
"btn btn-primary"
name=
"join"
value=
"{{{o.
__('Join')
}}}"
/>
</form>
</form>
</div>
</div>
</div>
</div>
...
...
tests/utils.js
View file @
32f0eb54
...
@@ -106,7 +106,9 @@
...
@@ -106,7 +106,9 @@
const
modal
=
roomspanel
.
add_room_modal
;
const
modal
=
roomspanel
.
add_room_modal
;
await
utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1500
)
await
utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1500
)
modal
.
el
.
querySelector
(
'
input[name="chatroom"]
'
).
value
=
jid
;
modal
.
el
.
querySelector
(
'
input[name="chatroom"]
'
).
value
=
jid
;
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
).
value
=
nick
;
if
(
nick
)
{
modal
.
el
.
querySelector
(
'
input[name="nickname"]
'
).
value
=
nick
;
}
modal
.
el
.
querySelector
(
'
form input[type="submit"]
'
).
click
();
modal
.
el
.
querySelector
(
'
form input[type="submit"]
'
).
click
();
await
utils
.
waitUntil
(()
=>
_converse
.
chatboxviews
.
get
(
jid
),
1000
);
await
utils
.
waitUntil
(()
=>
_converse
.
chatboxviews
.
get
(
jid
),
1000
);
return
_converse
.
chatboxviews
.
get
(
jid
);
return
_converse
.
chatboxviews
.
get
(
jid
);
...
...
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