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
26c1dbb0
Commit
26c1dbb0
authored
Sep 11, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates #1705. Add `getRoomsPanel` method to avoid dangling pointer
parent
d0b6e8fd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
24 deletions
+41
-24
CHANGES.md
CHANGES.md
+1
-0
src/converse-muc-views.js
src/converse-muc-views.js
+36
-24
src/utils/html.js
src/utils/html.js
+4
-0
No files found.
CHANGES.md
View file @
26c1dbb0
...
...
@@ -13,6 +13,7 @@
your preferred path and then rebuild all assets (e.g.
`make dist`
).
-
Use
`listenTo`
to avoid memory leaks when views get removed.
-
#1692 Bugfix:
`TypeError: oldest_message is undefined`
-
#1705 Bugfix:
`this.roomspanel`
is
`undefined`
after hibernating
## 5.0.1 (2019-08-14)
...
...
src/converse-muc-views.js
View file @
26c1dbb0
...
...
@@ -121,9 +121,10 @@ converse.plugins.add('converse-muc-views', {
});
function
renderRoomsPanel
()
{
if
(
this
.
roomspanel
&&
u
.
isVisible
(
this
.
roomspanel
.
el
))
{
return
;
const
viewWithRoomsPanel
=
{
renderRoomsPanel
()
{
if
(
this
.
roomspanel
&&
u
.
isInDOM
(
this
.
roomspanel
.
el
))
{
return
this
.
roomspanel
;
}
this
.
roomspanel
=
new
_converse
.
RoomsPanel
({
'
model
'
:
new
(
_converse
.
RoomsPanelModel
.
extend
({
...
...
@@ -143,9 +144,20 @@ converse.plugins.add('converse-muc-views', {
* @example _converse.api.listen.on('roomsPanelRendered', () => { ... });
*/
_converse
.
api
.
trigger
(
'
roomsPanelRendered
'
);
return
this
.
roomspanel
;
},
getRoomsPanel
()
{
if
(
this
.
roomspanel
&&
u
.
isInDOM
(
this
.
roomspanel
.
el
))
{
return
this
.
roomspanel
;
}
else
{
return
this
.
renderRoomsPanel
();
}
}
}
if
(
_converse
.
ControlBoxView
)
{
Object
.
assign
(
_converse
.
ControlBoxView
.
prototype
,
{
renderRoomsPanel
}
);
Object
.
assign
(
_converse
.
ControlBoxView
.
prototype
,
viewWithRoomsPanel
);
}
/* Insert groupchat info (based on returned #disco IQ stanza)
...
...
@@ -2057,7 +2069,7 @@ converse.plugins.add('converse-muc-views', {
function
setMUCDomain
(
domain
,
controlboxview
)
{
controlboxview
.
roomspanel
.
model
.
save
(
'
muc_domain
'
,
Strophe
.
getDomainFromJid
(
domain
));
controlboxview
.
getRoomsPanel
()
.
model
.
save
(
'
muc_domain
'
,
Strophe
.
getDomainFromJid
(
domain
));
}
function
setMUCDomainFromDisco
(
controlboxview
)
{
...
...
@@ -2085,7 +2097,7 @@ converse.plugins.add('converse-muc-views', {
function
fetchAndSetMUCDomain
(
controlboxview
)
{
if
(
controlboxview
.
model
.
get
(
'
connected
'
))
{
if
(
!
controlboxview
.
roomspanel
.
model
.
get
(
'
muc_domain
'
))
{
if
(
!
controlboxview
.
getRoomsPanel
()
.
model
.
get
(
'
muc_domain
'
))
{
if
(
_converse
.
muc_domain
===
undefined
)
{
setMUCDomainFromDisco
(
controlboxview
);
}
else
{
...
...
src/utils/html.js
View file @
26c1dbb0
...
...
@@ -498,6 +498,10 @@ function afterAnimationEnds (el, callback) {
}
}
u
.
isInDOM
=
function
(
el
)
{
return
document
.
querySelector
(
'
body
'
).
contains
(
el
);
}
u
.
isVisible
=
function
(
el
)
{
if
(
u
.
hasClass
(
'
hidden
'
,
el
))
{
return
false
;
...
...
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