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
1e5b6243
Commit
1e5b6243
authored
Feb 22, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't show bookmark toggles when PEP bookmarking not supported by the XMPP server
parent
5e320d03
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
19 deletions
+28
-19
CHANGES.md
CHANGES.md
+1
-0
src/converse-bookmarks.js
src/converse-bookmarks.js
+22
-18
src/converse-roomslist.js
src/converse-roomslist.js
+5
-1
No files found.
CHANGES.md
View file @
1e5b6243
...
...
@@ -5,6 +5,7 @@
-
Avoid
`eval`
(via
`_.template`
from lodash).
-
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
## 3.3.3 (2018-02-14)
...
...
src/converse-bookmarks.js
View file @
1e5b6243
...
...
@@ -87,11 +87,10 @@
this
.
__super__
.
renderHeading
.
apply
(
this
,
arguments
);
const
{
_converse
}
=
this
.
__super__
;
if
(
_converse
.
allow_bookmarks
)
{
_converse
.
api
.
disco
.
getIdentity
(
'
pubsub
'
,
'
pep
'
,
_converse
.
bare_jid
).
then
((
identity
)
=>
{
if
(
_
.
isNil
(
identity
)
)
{
return
;
_converse
.
checkBookmarksSupport
().
then
((
supported
)
=>
{
if
(
supported
)
{
this
.
renderBookmarkToggle
()
;
}
this
.
renderBookmarkToggle
();
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
},
...
...
@@ -530,26 +529,31 @@
}
});
_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
()
{
if
(
!
_converse
.
allow_bookmarks
)
{
return
;
}
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
)
=>
{
const
identity
=
args
[
0
],
options_support
=
args
[
1
];
if
(
_
.
isNil
(
identity
)
||
(
!
options_support
.
supported
&&
!
_converse
.
allow_public_bookmarks
))
{
_converse
.
checkBookmarksSupport
().
then
((
supported
)
=>
{
if
(
supported
)
{
_converse
.
bookmarks
=
new
_converse
.
Bookmarks
();
_converse
.
bookmarksview
=
new
_converse
.
BookmarksView
({
'
model
'
:
_converse
.
bookmarks
});
_converse
.
bookmarks
.
fetchBookmarks
()
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
))
.
then
(()
=>
_converse
.
emit
(
'
bookmarksInitialized
'
));
}
else
{
_converse
.
emit
(
'
bookmarksInitialized
'
);
return
;
}
_converse
.
bookmarks
=
new
_converse
.
Bookmarks
();
_converse
.
bookmarksview
=
new
_converse
.
BookmarksView
({
'
model
'
:
_converse
.
bookmarks
});
_converse
.
bookmarks
.
fetchBookmarks
()
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
))
.
then
(()
=>
_converse
.
emit
(
'
bookmarksInitialized
'
));
});
}
...
...
src/converse-roomslist.js
View file @
1e5b6243
...
...
@@ -118,7 +118,11 @@
toHTML
()
{
return
tpl_rooms_list_item
(
_
.
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_remove_bookmark
'
:
__
(
'
Unbookmark this room
'
),
'
info_add_bookmark
'
:
__
(
'
Bookmark this room
'
),
...
...
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