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
59edcb23
Commit
59edcb23
authored
Jul 21, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
muc: Add JID validation to the occupant invite form
parent
0bd69b3b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
5 deletions
+24
-5
CHANGES.md
CHANGES.md
+1
-1
src/converse-muc.js
src/converse-muc.js
+20
-4
src/templates/chatroom_invite.html
src/templates/chatroom_invite.html
+3
-0
No files found.
CHANGES.md
View file @
59edcb23
...
...
@@ -9,7 +9,7 @@
### New features and improvements
-
Add support for Emojis (either native, or via
<a
href=
"https://www.emojione.com/"
>
Emojione
</a>
). [jcbrand]
-
Add JID validation
in the contact add
form. [jcbrand]
-
Add JID validation
to the contact add form and the occupant invite
form. [jcbrand]
-
#896 Consistently use
`XMPP username`
in user-facing text (instead of JID, Jabber ID etc.). [jcbrand]
### New configuration settings
...
...
src/converse-muc.js
View file @
59edcb23
...
...
@@ -2140,6 +2140,7 @@
if
(
_
.
isNull
(
form
))
{
const
heading
=
this
.
el
.
querySelector
(
'
.occupants-heading
'
);
form
=
tpl_chatroom_invite
({
'
error_message
'
:
null
,
'
label_invitation
'
:
__
(
'
Invite
'
),
});
heading
.
insertAdjacentHTML
(
'
afterend
'
,
form
);
...
...
@@ -2329,17 +2330,31 @@
if
(
reason
!==
null
)
{
this
.
chatroomview
.
directInvite
(
suggestion
.
text
.
value
,
reason
);
}
const
form
=
suggestion
.
target
.
form
,
error
=
form
.
querySelector
(
'
.pure-form-message.error
'
);
if
(
!
_
.
isNull
(
error
))
{
error
.
parentNode
.
removeChild
(
error
);
}
suggestion
.
target
.
value
=
''
;
},
inviteFormSubmitted
(
evt
)
{
evt
.
preventDefault
();
const
el
=
evt
.
target
.
querySelector
(
'
input.invited-contact
'
);
const
el
=
evt
.
target
.
querySelector
(
'
input.invited-contact
'
),
jid
=
el
.
value
;
if
(
!
jid
||
_
.
filter
(
jid
.
split
(
'
@
'
)).
length
<
2
)
{
evt
.
target
.
outerHTML
=
tpl_chatroom_invite
({
'
error_message
'
:
__
(
'
Please enter a valid XMPP username
'
),
'
label_invitation
'
:
__
(
'
Invite
'
),
});
this
.
initInviteWidget
();
return
;
}
this
.
promptForInvite
({
'
target
'
:
el
,
'
text
'
:
{
'
label
'
:
el
.
value
,
'
value
'
:
el
.
value
'
label
'
:
jid
,
'
value
'
:
jid
}});
},
...
...
@@ -2365,7 +2380,8 @@
'
minChars
'
:
1
,
'
list
'
:
list
});
el
.
addEventListener
(
'
awesomplete-selectcomplete
'
,
this
.
promptForInvite
.
bind
(
this
));
el
.
addEventListener
(
'
awesomplete-selectcomplete
'
,
this
.
promptForInvite
.
bind
(
this
));
}
});
...
...
src/templates/chatroom_invite.html
View file @
59edcb23
<form
class=
"pure-form room-invite"
>
{[ if (error_message) { ]}
<span
class=
"pure-form-message error"
>
{{{error_message}}}
</span>
{[ } ]}
<input
class=
"invited-contact"
placeholder=
"{{{label_invitation}}}"
type=
"text"
/>
</form>
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