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
2d89589b
Commit
2d89589b
authored
Jul 10, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bookmarks: clear the `fetched_flag` upon logout
parent
8c1c665e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
src/converse-bookmarks.js
src/converse-bookmarks.js
+9
-8
src/converse-muc.js
src/converse-muc.js
+4
-1
No files found.
src/converse-bookmarks.js
View file @
2d89589b
...
...
@@ -50,6 +50,7 @@
if
(
!
_
.
isUndefined
(
this
.
bookmarks
))
{
this
.
bookmarks
.
reset
();
this
.
bookmarks
.
browserStorage
.
_clear
();
window
.
sessionStorage
.
removeItem
(
this
.
bookmarks
.
fetched_flag
);
}
},
...
...
@@ -218,7 +219,7 @@
this
.
on
(
'
remove
'
,
this
.
sendBookmarkStanza
,
this
);
var
cache_key
=
'
converse.room-bookmarks
'
+
_converse
.
bare_jid
;
this
.
ca
ched_flag
=
b64_sha1
(
cache_key
+
'
fetched
'
);
this
.
fet
ched_flag
=
b64_sha1
(
cache_key
+
'
fetched
'
);
this
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
b64_sha1
(
cache_key
)
);
...
...
@@ -234,16 +235,16 @@
fetchBookmarks
:
function
()
{
var
deferred
=
new
$
.
Deferred
();
var
promise
=
deferred
.
promise
();
if
(
window
.
sessionStorage
.
getItem
(
this
.
browserStorage
.
name
)
)
{
if
(
this
.
browserStorage
.
records
.
length
>
0
)
{
this
.
fetch
({
'
success
'
:
_
.
bind
(
this
.
onCachedBookmarksFetched
,
this
,
deferred
),
'
error
'
:
_
.
bind
(
this
.
onCachedBookmarksFetched
,
this
,
deferred
)
});
}
else
if
(
!
window
.
sessionStorage
.
getItem
(
this
.
ca
ched_flag
))
{
// There aren't any cached bookmarks
, and the cache is
//
not set to null. S
o we query the XMPP server.
}
else
if
(
!
window
.
sessionStorage
.
getItem
(
this
.
fet
ched_flag
))
{
// There aren't any cached bookmarks
and the
//
`fetched_flag` is off, s
o we query the XMPP server.
// If nothing is returned from the XMPP server, we set
// the
cache to null
to avoid calling the server again.
// the
`fetched_flag`
to avoid calling the server again.
this
.
fetchBookmarksFromServer
(
deferred
);
}
else
{
deferred
.
resolve
();
...
...
@@ -344,9 +345,9 @@
},
onBookmarksReceivedError
:
function
(
deferred
,
iq
)
{
window
.
sessionStorage
.
setItem
(
this
.
ca
ched_flag
,
true
);
window
.
sessionStorage
.
setItem
(
this
.
fet
ched_flag
,
true
);
_converse
.
log
(
'
Error while fetching bookmarks
'
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
iq
);
_converse
.
log
(
iq
,
Strophe
.
LogLevel
.
DEBUG
);
if
(
!
_
.
isNil
(
deferred
))
{
return
deferred
.
reject
();
}
...
...
src/converse-muc.js
View file @
2d89589b
...
...
@@ -2219,7 +2219,10 @@
onOccupantAdded
:
function
(
item
)
{
var
view
=
this
.
get
(
item
.
get
(
'
id
'
));
if
(
!
view
)
{
view
=
this
.
add
(
item
.
get
(
'
id
'
),
new
_converse
.
ChatRoomOccupantView
({
model
:
item
}));
view
=
this
.
add
(
item
.
get
(
'
id
'
),
new
_converse
.
ChatRoomOccupantView
({
model
:
item
})
);
}
else
{
delete
view
.
model
;
// Remove ref to old model to help garbage collection
view
.
model
=
item
;
...
...
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