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
946a2400
Commit
946a2400
authored
Feb 27, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure to show the invite widget
when the room features change.
parent
a21fdce8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
14 deletions
+47
-14
spec/chatroom.js
spec/chatroom.js
+5
-0
src/config.js
src/config.js
+1
-0
src/converse-muc.js
src/converse-muc.js
+38
-6
src/templates/chatroom_invite.html
src/templates/chatroom_invite.html
+3
-0
src/templates/chatroom_sidebar.html
src/templates/chatroom_sidebar.html
+0
-8
No files found.
spec/chatroom.js
View file @
946a2400
...
...
@@ -922,6 +922,11 @@
return
"
Please join!
"
;
});
var
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
// XXX: cheating a lttle bit, normally this'll be set after
// receiving the features for the room.
view
.
model
.
set
(
'
open
'
,
'
true
'
);
spyOn
(
view
,
'
directInvite
'
).
andCallThrough
();
var
$input
;
view
.
$el
.
find
(
'
.chat-area
'
).
remove
();
...
...
src/config.js
View file @
946a2400
...
...
@@ -126,6 +126,7 @@ require.config({
"
chatroom_features
"
:
"
src/templates/chatroom_features
"
,
"
chatroom_form
"
:
"
src/templates/chatroom_form
"
,
"
chatroom_head
"
:
"
src/templates/chatroom_head
"
,
"
chatroom_invite
"
:
"
src/templates/chatroom_invite
"
,
"
chatroom_nickname_form
"
:
"
src/templates/chatroom_nickname_form
"
,
"
chatroom_password_form
"
:
"
src/templates/chatroom_password_form
"
,
"
chatroom_sidebar
"
:
"
src/templates/chatroom_sidebar
"
,
...
...
src/converse-muc.js
View file @
946a2400
...
...
@@ -17,6 +17,7 @@
"
tpl!chatroom_features
"
,
"
tpl!chatroom_form
"
,
"
tpl!chatroom_head
"
,
"
tpl!chatroom_invite
"
,
"
tpl!chatroom_nickname_form
"
,
"
tpl!chatroom_password_form
"
,
"
tpl!chatroom_sidebar
"
,
...
...
@@ -37,6 +38,7 @@
tpl_chatroom_features
,
tpl_chatroom_form
,
tpl_chatroom_head
,
tpl_chatroom_invite
,
tpl_chatroom_nickname_form
,
tpl_chatroom_password_form
,
tpl_chatroom_sidebar
,
...
...
@@ -1944,8 +1946,12 @@
initialize
:
function
()
{
this
.
model
.
on
(
"
add
"
,
this
.
onOccupantAdded
,
this
);
var
debouncedRenderRoomFeatures
=
_
.
debounce
(
this
.
renderRoomFeatures
,
100
);
this
.
chatroomview
=
this
.
model
.
chatroomview
;
this
.
chatroomview
.
model
.
on
(
'
change:open
'
,
this
.
renderInviteWidget
,
this
);
this
.
chatroomview
.
model
.
on
(
'
change:affiliation
'
,
this
.
renderInviteWidget
,
this
);
var
debouncedRenderRoomFeatures
=
_
.
debounce
(
this
.
renderRoomFeatures
,
100
);
this
.
chatroomview
.
model
.
on
(
'
change:hidden
'
,
debouncedRenderRoomFeatures
,
this
);
this
.
chatroomview
.
model
.
on
(
'
change:mam_enabled
'
,
debouncedRenderRoomFeatures
,
this
);
this
.
chatroomview
.
model
.
on
(
'
change:membersonly
'
,
debouncedRenderRoomFeatures
,
this
);
...
...
@@ -1967,22 +1973,39 @@
_
.
extend
(
this
.
chatroomview
.
model
.
toJSON
(),
{
'
allow_muc_invitations
'
:
_converse
.
allow_muc_invitations
,
'
label_features
'
:
__
(
'
Features
'
),
'
label_invitation
'
:
__
(
'
Invite
'
),
'
label_occupants
'
:
__
(
'
Occupants
'
),
'
label_occupants
'
:
__
(
'
Occupants
'
)
}))
);
if
(
_converse
.
allow_muc_invitations
)
{
_converse
.
api
.
waitUntil
(
'
rosterContactsFetched
'
).
then
(
this
.
init
InviteWidget
.
bind
(
this
));
_converse
.
api
.
waitUntil
(
'
rosterContactsFetched
'
).
then
(
this
.
render
InviteWidget
.
bind
(
this
));
}
return
this
.
renderRoomFeatures
();
},
renderInviteWidget
:
function
()
{
var
form
=
this
.
el
.
querySelector
(
'
form.room-invite
'
);
if
(
this
.
shouldInviteWidgetBeShown
())
{
if
(
_
.
isNull
(
form
))
{
var
heading
=
this
.
el
.
querySelector
(
'
.occupants-heading
'
);
form
=
tpl_chatroom_invite
({
'
label_invitation
'
:
__
(
'
Invite
'
),
});
heading
.
insertAdjacentHTML
(
'
afterend
'
,
form
);
this
.
initInviteWidget
();
}
}
else
{
if
(
!
_
.
isNull
(
form
))
{
form
.
remove
();
}
}
return
this
;
},
renderRoomFeatures
:
function
()
{
this
.
$
(
'
.features-list
'
).
html
(
tpl_chatroom_features
(
_
.
extend
(
this
.
chatroomview
.
model
.
toJSON
(),
{
'
label_hidden
'
:
__
(
'
Hidden
'
),
'
label_invitation
'
:
__
(
'
Invite
'
),
'
label_mam_enabled
'
:
__
(
'
Message archiving
'
),
'
label_membersonly
'
:
__
(
'
Members only
'
),
'
label_moderated
'
:
__
(
'
Moderated
'
),
...
...
@@ -2130,8 +2153,18 @@
}});
},
shouldInviteWidgetBeShown
:
function
()
{
return
_converse
.
allow_muc_invitations
&&
(
this
.
chatroomview
.
model
.
get
(
'
open
'
)
||
this
.
chatroomview
.
model
.
get
(
'
affiliation
'
)
===
"
owner
"
);
},
initInviteWidget
:
function
()
{
var
form
=
this
.
el
.
querySelector
(
'
form.room-invite
'
);
if
(
_
.
isNull
(
form
))
{
return
;
}
form
.
addEventListener
(
'
submit
'
,
this
.
inviteFormSubmitted
.
bind
(
this
));
var
el
=
this
.
el
.
querySelector
(
'
input.invited-contact
'
);
var
list
=
_converse
.
roster
.
map
(
function
(
item
)
{
...
...
@@ -2143,7 +2176,6 @@
'
list
'
:
list
});
el
.
addEventListener
(
'
awesomplete-selectcomplete
'
,
this
.
promptForInvite
.
bind
(
this
));
return
this
;
}
});
...
...
src/templates/chatroom_invite.html
0 → 100644
View file @
946a2400
<form
class=
"pure-form room-invite"
>
<input
class=
"invited-contact"
placeholder=
"{{{label_invitation}}}"
type=
"text"
/>
</form>
src/templates/chatroom_sidebar.html
View file @
946a2400
<!-- <div class="occupants"> -->
<p
class=
"occupants-heading"
>
{{{label_occupants}}}
</p>
<form
class=
"pure-form room-invite
{[ if (!allow_muc_invitations || (!open && affiliation !== "
owner
"))
{
]}
hidden
{[
}
]}
"
>
<input
class=
"invited-contact"
placeholder=
"{{{label_invitation}}}"
type=
"text"
/>
</form>
<ul
class=
"occupant-list"
></ul>
<div
class=
"chatroom-features"
>
<p
class=
"occupants-heading"
>
{{{label_features}}}
</p>
<ul
class=
"features-list"
></ul>
...
...
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