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
dffcc13d
Commit
dffcc13d
authored
Oct 10, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1140 Add support for destroyed chatrooms
parent
7cc59b9e
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
162 additions
and
2 deletions
+162
-2
CHANGES.md
CHANGES.md
+1
-0
dist/converse.js
dist/converse.js
+74
-2
spec/chatroom.js
spec/chatroom.js
+33
-0
src/converse-muc-views.js
src/converse-muc-views.js
+42
-0
src/templates/chatroom_destroyed.html
src/templates/chatroom_destroyed.html
+12
-0
No files found.
CHANGES.md
View file @
dffcc13d
...
...
@@ -5,6 +5,7 @@
-
Bugfix. Handler not triggered when submitting MUC password form 2nd time
-
Bugfix. MUC features weren't being refreshed when saving the config form
-
#1063 URLs in the topic / subject are not clickable
-
#1140 Add support for destroyed chatrooms
-
#1190 MUC Participants column disappears in certain viewport widths
-
#1199 Can't get back from to login screen from registration screen
-
#1204 Link encoding issue
...
...
dist/converse.js
View file @
dffcc13d
This diff is collapsed.
Click to expand it.
spec/chatroom.js
View file @
dffcc13d
...
...
@@ -1245,6 +1245,39 @@
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}));
it
(
"
properly handles notification that a room has been destroyed
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
test_utils
.
openChatRoomViaModal
(
_converse
,
'
problematic@muc.localhost
'
,
'
dummy
'
)
.
then
(
function
()
{
const
presence
=
$pres
().
attrs
({
from
:
'
problematic@muc.localhost
'
,
id
:
'
n13mt3l
'
,
to
:
'
dummy@localhost/pda
'
,
type
:
'
error
'
})
.
c
(
'
error
'
).
attrs
({
'
type
'
:
'
cancel
'
})
.
c
(
'
gone
'
).
attrs
({
'
xmlns
'
:
'
urn:ietf:params:xml:ns:xmpp-stanzas
'
})
.
t
(
'
xmpp:other-room@chat.jabberfr.org?join
'
).
up
()
.
c
(
'
text
'
).
attrs
({
'
xmlns
'
:
'
urn:ietf:params:xml:ns:xmpp-stanzas
'
})
.
t
(
"
We didn't like the name
"
).
nodeTree
;
const
view
=
_converse
.
chatboxviews
.
get
(
'
problematic@muc.localhost
'
);
spyOn
(
view
,
'
showErrorMessage
'
).
and
.
callThrough
();
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
expect
(
view
.
el
.
querySelector
(
'
.chatroom-body .disconnect-msg
'
).
textContent
)
.
toBe
(
'
This room no longer exists
'
);
expect
(
view
.
el
.
querySelector
(
'
.chatroom-body .destroyed-reason
'
).
textContent
)
.
toBe
(
`"We didn't like the name"`
);
expect
(
view
.
el
.
querySelector
(
'
.chatroom-body .moved-label
'
).
textContent
.
trim
())
.
toBe
(
'
The conversation has moved. Click below to enter.
'
);
expect
(
view
.
el
.
querySelector
(
'
.chatroom-body .moved-link
'
).
textContent
.
trim
())
.
toBe
(
`other-room@chat.jabberfr.org`
);
done
();
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}));
it
(
"
will use the user's reserved nickname, if it exists
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
...
...
src/converse-muc-views.js
View file @
dffcc13d
...
...
@@ -14,6 +14,7 @@
"
templates/chatarea.html
"
,
"
templates/chatroom.html
"
,
"
templates/chatroom_details_modal.html
"
,
"
templates/chatroom_destroyed.html
"
,
"
templates/chatroom_disconnect.html
"
,
"
templates/chatroom_features.html
"
,
"
templates/chatroom_form.html
"
,
...
...
@@ -42,6 +43,7 @@
tpl_chatarea
,
tpl_chatroom
,
tpl_chatroom_details_modal
,
tpl_chatroom_destroyed
,
tpl_chatroom_disconnect
,
tpl_chatroom_features
,
tpl_chatroom_form
,
...
...
@@ -530,6 +532,7 @@
this
.
model
.
on
(
'
change:affiliation
'
,
this
.
renderHeading
,
this
);
this
.
model
.
on
(
'
change:connection_status
'
,
this
.
afterConnected
,
this
);
this
.
model
.
on
(
'
change:jid
'
,
this
.
renderHeading
,
this
);
this
.
model
.
on
(
'
change:name
'
,
this
.
renderHeading
,
this
);
this
.
model
.
on
(
'
change:subject
'
,
this
.
renderHeading
,
this
);
this
.
model
.
on
(
'
change:subject
'
,
this
.
setChatRoomSubject
,
this
);
...
...
@@ -547,7 +550,11 @@
this
.
createOccupantsView
();
this
.
render
().
insertIntoDOM
();
this
.
registerHandlers
();
this
.
enterRoom
();
},
enterRoom
(
ev
)
{
if
(
ev
)
{
ev
.
preventDefault
();
}
if
(
this
.
model
.
get
(
'
connection_status
'
)
!==
converse
.
ROOMSTATUS
.
ENTERED
)
{
const
handler
=
()
=>
{
if
(
!
u
.
isPersistableModel
(
this
.
model
))
{
...
...
@@ -1316,6 +1323,39 @@
.
addEventListener
(
'
submit
'
,
ev
=>
this
.
submitPassword
(
ev
),
false
);
},
showDestroyedMessage
(
error
)
{
u
.
hideElement
(
this
.
el
.
querySelector
(
'
.chat-area
'
));
u
.
hideElement
(
this
.
el
.
querySelector
(
'
.occupants
'
));
_
.
each
(
this
.
el
.
querySelectorAll
(
'
.spinner
'
),
u
.
removeElement
);
const
container
=
this
.
el
.
querySelector
(
'
.disconnect-container
'
);
const
moved_jid
=
_
.
get
(
sizzle
(
'
gone[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]
'
,
error
).
pop
(),
'
textContent
'
).
replace
(
/^xmpp:/
,
''
).
replace
(
/
\?
join$/
,
''
);
const
reason
=
_
.
get
(
sizzle
(
'
text[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]
'
,
error
).
pop
(),
'
textContent
'
);
container
.
innerHTML
=
tpl_chatroom_destroyed
({
'
_
'
:
_
,
'
__
'
:
__
,
'
jid
'
:
moved_jid
,
'
reason
'
:
reason
?
`"
${
reason
}
"`
:
null
});
const
switch_el
=
container
.
querySelector
(
'
a.switch-chat
'
);
if
(
switch_el
)
{
switch_el
.
addEventListener
(
'
click
'
,
ev
=>
{
ev
.
preventDefault
();
this
.
model
.
save
(
'
jid
'
,
moved_jid
);
container
.
innerHTML
=
''
;
this
.
showSpinner
();
this
.
enterRoom
();
});
}
u
.
showElement
(
container
);
},
showDisconnectMessages
(
msgs
)
{
if
(
_
.
isString
(
msgs
))
{
msgs
=
[
msgs
];
...
...
@@ -1585,6 +1625,8 @@
this
.
showDisconnectMessages
(
__
(
'
You are not allowed to create new groupchats.
'
));
}
else
if
(
!
_
.
isNull
(
error
.
querySelector
(
'
not-acceptable
'
)))
{
this
.
showDisconnectMessages
(
__
(
"
Your nickname doesn't conform to this groupchat's policies.
"
));
}
else
if
(
sizzle
(
'
gone[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]
'
,
error
).
length
)
{
this
.
showDestroyedMessage
(
error
);
}
else
if
(
!
_
.
isNull
(
error
.
querySelector
(
'
conflict
'
)))
{
this
.
onNicknameClash
(
presence
);
}
else
if
(
!
_
.
isNull
(
error
.
querySelector
(
'
item-not-found
'
)))
{
...
...
src/templates/chatroom_destroyed.html
0 → 100644
View file @
dffcc13d
<div
class=
"alert alert-danger"
>
<h3
class=
"alert-heading disconnect-msg"
>
{{{o.__('This room no longer exists')}}}
</h3>
<p
class=
"destroyed-reason"
>
{{{o.reason}}}
</p>
{[ if (o.jid) { ]}
<p
class=
"moved-label"
>
{{{o.__('The conversation has moved. Click below to enter.') }}}
</p>
<p
class=
"moved-link"
><a
class=
"switch-chat"
href=
"#"
>
{{{o.jid}}}
</a></p>
{[ } ]}
</div>
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