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
224e1eee
Commit
224e1eee
authored
Feb 22, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into bootstrap4
parents
a5513229
1e5b6243
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
50 deletions
+71
-50
CHANGES.md
CHANGES.md
+2
-0
src/converse-bookmarks.js
src/converse-bookmarks.js
+27
-31
src/converse-core.js
src/converse-core.js
+3
-0
src/converse-minimize.js
src/converse-minimize.js
+0
-6
src/converse-roomslist.js
src/converse-roomslist.js
+17
-13
src/utils.js
src/utils.js
+22
-0
No files found.
CHANGES.md
View file @
224e1eee
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
-
Avoid
`eval`
(via
`_.template`
from lodash).
-
Avoid
`eval`
(via
`_.template`
from lodash).
-
Bugfix. Avatars weren't being shown.
-
Bugfix. Avatars weren't being shown.
-
Bugfix. Bookmarks list and open rooms list weren't recreated after logging in for a 2nd time (without reloading the browser).
-
Don't show bookmark toggles when PEP bookmarking not supported by the XMPP server.
-
Add LibreJS support
-
Add LibreJS support
## 3.3.3 (2018-02-14)
## 3.3.3 (2018-02-14)
...
...
src/converse-bookmarks.js
View file @
224e1eee
...
@@ -87,11 +87,10 @@
...
@@ -87,11 +87,10 @@
this
.
__super__
.
renderHeading
.
apply
(
this
,
arguments
);
this
.
__super__
.
renderHeading
.
apply
(
this
,
arguments
);
const
{
_converse
}
=
this
.
__super__
;
const
{
_converse
}
=
this
.
__super__
;
if
(
_converse
.
allow_bookmarks
)
{
if
(
_converse
.
allow_bookmarks
)
{
_converse
.
api
.
disco
.
getIdentity
(
'
pubsub
'
,
'
pep
'
,
_converse
.
bare_jid
).
then
((
identity
)
=>
{
_converse
.
checkBookmarksSupport
().
then
((
supported
)
=>
{
if
(
_
.
isNil
(
identity
)
)
{
if
(
supported
)
{
return
;
this
.
renderBookmarkToggle
()
;
}
}
this
.
renderBookmarkToggle
();
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
}
},
},
...
@@ -533,41 +532,38 @@
...
@@ -533,41 +532,38 @@
}
}
});
});
_converse
.
checkBookmarksSupport
=
function
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
Promise
.
all
([
_converse
.
api
.
disco
.
getIdentity
(
'
pubsub
'
,
'
pep
'
,
_converse
.
bare_jid
),
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
PUBSUB
+
'
#publish-options
'
,
_converse
.
bare_jid
)
]).
then
((
args
)
=>
{
resolve
(
args
[
0
]
&&
(
args
[
1
].
supported
||
_converse
.
allow_public_bookmarks
));
});
});
}
const
initBookmarks
=
function
()
{
const
initBookmarks
=
function
()
{
if
(
!
_converse
.
allow_bookmarks
)
{
if
(
!
_converse
.
allow_bookmarks
)
{
return
;
return
;
}
}
Promise
.
all
([
_converse
.
checkBookmarksSupport
().
then
((
supported
)
=>
{
_converse
.
api
.
disco
.
getIdentity
(
'
pubsub
'
,
'
pep
'
,
_converse
.
bare_jid
),
if
(
supported
)
{
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
PUBSUB
+
'
#publish-options
'
,
_converse
.
bare_jid
)
_converse
.
bookmarks
=
new
_converse
.
Bookmarks
();
]).
then
((
args
)
=>
{
_converse
.
bookmarksview
=
new
_converse
.
BookmarksView
({
'
model
'
:
_converse
.
bookmarks
});
const
identity
=
args
[
0
],
_converse
.
bookmarks
.
fetchBookmarks
()
options_support
=
args
[
1
];
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
))
.
then
(()
=>
_converse
.
emit
(
'
bookmarksInitialized
'
));
if
(
_
.
isNil
(
identity
)
||
(
!
options_support
.
supported
&&
!
_converse
.
allow_public_bookmarks
))
{
}
else
{
_converse
.
emit
(
'
bookmarksInitialized
'
);
_converse
.
emit
(
'
bookmarksInitialized
'
);
return
;
}
}
_converse
.
bookmarks
=
new
_converse
.
Bookmarks
();
_converse
.
bookmarks
.
fetchBookmarks
().
then
(()
=>
{
_converse
.
bookmarksview
=
new
_converse
.
BookmarksView
(
{
'
model
'
:
_converse
.
bookmarks
}
);
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
))
.
then
(()
=>
{
_converse
.
emit
(
'
bookmarksInitialized
'
);
});
}).
catch
((
e
)
=>
{
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
emit
(
'
bookmarksInitialized
'
);
});
});
}
;
}
Promise
.
all
([
u
.
onMultipleEvents
([
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
),
{
'
object
'
:
_converse
,
'
event
'
:
'
chatBoxesFetched
'
},
_converse
.
api
.
waitUntil
(
'
roomsPanelRendered
'
)
{
'
object
'
:
_converse
,
'
event
'
:
'
roomsPanelRendered
'
}
]).
then
(
initBookmarks
)
],
initBookmarks
);
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
_converse
.
on
(
'
reconnected
'
,
initBookmarks
);
_converse
.
on
(
'
reconnected
'
,
initBookmarks
);
...
...
src/converse-core.js
View file @
224e1eee
...
@@ -658,6 +658,9 @@
...
@@ -658,6 +658,9 @@
}
else
{
}
else
{
_converse
.
_tearDown
();
_converse
.
_tearDown
();
}
}
// Recreate all the promises
_
.
each
(
_
.
keys
(
_converse
.
promises
),
addPromise
);
_converse
.
emit
(
'
logout
'
);
_converse
.
emit
(
'
logout
'
);
};
};
...
...
src/converse-minimize.js
View file @
224e1eee
...
@@ -522,7 +522,6 @@
...
@@ -522,7 +522,6 @@
const
new_html
=
tpl_chatbox_minimize
(
const
new_html
=
tpl_chatbox_minimize
(
{
info_minimize
:
__
(
'
Minimize this chat box
'
)}
{
info_minimize
:
__
(
'
Minimize this chat box
'
)}
);
);
const
el
=
view
.
el
.
querySelector
(
'
.toggle-chatbox-button
'
);
const
el
=
view
.
el
.
querySelector
(
'
.toggle-chatbox-button
'
);
if
(
el
)
{
if
(
el
)
{
el
.
outerHTML
=
new_html
;
el
.
outerHTML
=
new_html
;
...
@@ -539,11 +538,6 @@
...
@@ -539,11 +538,6 @@
_converse
.
chatboxviews
.
trimChats
(
chatbox
);
_converse
.
chatboxviews
.
trimChats
(
chatbox
);
}
}
});
});
const
logOut
=
function
()
{
_converse
.
minimized_chats
.
remove
();
};
_converse
.
on
(
'
logout
'
,
logOut
);
}
}
});
});
}));
}));
src/converse-roomslist.js
View file @
224e1eee
...
@@ -118,7 +118,11 @@
...
@@ -118,7 +118,11 @@
toHTML
()
{
toHTML
()
{
return
tpl_rooms_list_item
(
return
tpl_rooms_list_item
(
_
.
extend
(
this
.
model
.
toJSON
(),
{
_
.
extend
(
this
.
model
.
toJSON
(),
{
'
allow_bookmarks
'
:
_converse
.
allow_bookmarks
,
// XXX: By the time this renders, the _converse.bookmarks
// collection should already exist if bookmarks are
// supported by the XMPP server. So we can use it
// as a check for support (other ways of checking are async).
'
allow_bookmarks
'
:
_converse
.
allow_bookmarks
&&
_converse
.
bookmarks
,
'
info_leave_room
'
:
__
(
'
Leave this room
'
),
'
info_leave_room
'
:
__
(
'
Leave this room
'
),
'
info_remove_bookmark
'
:
__
(
'
Unbookmark this room
'
),
'
info_remove_bookmark
'
:
__
(
'
Unbookmark this room
'
),
'
info_add_bookmark
'
:
__
(
'
Bookmark this room
'
),
'
info_add_bookmark
'
:
__
(
'
Bookmark this room
'
),
...
@@ -248,18 +252,18 @@
...
@@ -248,18 +252,18 @@
);
);
};
};
Promise
.
all
([
if
(
_converse
.
allow_bookmarks
)
{
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
),
u
.
onMultipleEvents
([
_converse
.
api
.
waitUntil
(
'
roomsPanelRendered
'
)
{
'
object
'
:
_converse
,
'
event
'
:
'
chatBoxesFetched
'
},
]).
then
(()
=>
{
{
'
object
'
:
_converse
,
'
event
'
:
'
roomsPanelRendered
'
},
if
(
_converse
.
allow_bookmarks
)
{
{
'
object
'
:
_converse
,
'
event
'
:
'
bookmarksInitialized
'
}
_converse
.
api
.
waitUntil
(
'
bookmarksInitialized
'
).
then
(
],
initRoomsListView
);
initRoomsListView
}
else
{
);
u
.
onMultipleEvents
([
}
else
{
{
'
object
'
:
_converse
,
'
event
'
:
'
chatBoxesFetched
'
},
initRoomsListView
();
{
'
object
'
:
_converse
,
'
event
'
:
'
roomsPanelRendered
'
}
}
],
initRoomsListView
);
}
);
}
_converse
.
api
.
listen
.
on
(
'
reconnected
'
,
initRoomsListView
);
_converse
.
api
.
listen
.
on
(
'
reconnected
'
,
initRoomsListView
);
}
}
...
...
src/utils.js
View file @
224e1eee
...
@@ -662,6 +662,28 @@
...
@@ -662,6 +662,28 @@
});
});
};
};
u
.
onMultipleEvents
=
function
(
events
=
[],
callback
)
{
/* Call the callback once all the events have been triggered
*
* Parameters:
* (Array) events: An array of objects, with keys `object` and
* `event`, representing the event name and the object it's
* triggered upon.
* (Function) callback: The function to call once all events have
* been triggered.
*/
let
triggered
=
[];
function
handler
(
result
)
{
triggered
.
push
(
result
)
if
(
events
.
length
===
triggered
.
length
)
{
callback
(
triggered
);
triggered
=
[];
}
}
_
.
each
(
events
,
(
map
)
=>
map
.
object
.
on
(
map
.
event
,
handler
));
};
u
.
safeSave
=
function
(
model
,
attributes
)
{
u
.
safeSave
=
function
(
model
,
attributes
)
{
if
(
u
.
isPersistableModel
(
model
))
{
if
(
u
.
isPersistableModel
(
model
))
{
model
.
save
(
attributes
);
model
.
save
(
attributes
);
...
...
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