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
36e078c9
Commit
36e078c9
authored
Jun 23, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: Rename `saveWithFallback` to `safeSave`
parent
86c20ce2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
15 deletions
+15
-15
src/converse-chatview.js
src/converse-chatview.js
+1
-1
src/converse-minimize.js
src/converse-minimize.js
+2
-2
src/converse-muc.js
src/converse-muc.js
+8
-8
src/utils.js
src/utils.js
+4
-4
No files found.
src/converse-chatview.js
View file @
36e078c9
...
@@ -839,7 +839,7 @@
...
@@ -839,7 +839,7 @@
scrolled
=
false
;
scrolled
=
false
;
this
.
onScrolledDown
();
this
.
onScrolledDown
();
}
}
utils
.
sa
veWithFallback
(
this
.
model
,
{
'
scrolled
'
:
scrolled
});
utils
.
sa
feSave
(
this
.
model
,
{
'
scrolled
'
:
scrolled
});
},
150
),
},
150
),
viewUnreadMessages
:
function
()
{
viewUnreadMessages
:
function
()
{
...
...
src/converse-minimize.js
View file @
36e078c9
...
@@ -71,14 +71,14 @@
...
@@ -71,14 +71,14 @@
},
},
maximize
:
function
()
{
maximize
:
function
()
{
utils
.
sa
veWithFallback
(
this
,
{
utils
.
sa
feSave
(
this
,
{
'
minimized
'
:
false
,
'
minimized
'
:
false
,
'
time_opened
'
:
moment
().
valueOf
()
'
time_opened
'
:
moment
().
valueOf
()
});
});
},
},
minimize
:
function
()
{
minimize
:
function
()
{
utils
.
sa
veWithFallback
(
this
,
{
utils
.
sa
feSave
(
this
,
{
'
minimized
'
:
true
,
'
minimized
'
:
true
,
'
time_minimized
'
:
moment
().
format
()
'
time_minimized
'
:
moment
().
format
()
});
});
...
...
src/converse-muc.js
View file @
36e078c9
...
@@ -137,7 +137,7 @@
...
@@ -137,7 +137,7 @@
_tearDown
:
function
()
{
_tearDown
:
function
()
{
var
rooms
=
this
.
chatboxes
.
where
({
'
type
'
:
CHATROOMS_TYPE
});
var
rooms
=
this
.
chatboxes
.
where
({
'
type
'
:
CHATROOMS_TYPE
});
_
.
each
(
rooms
,
function
(
room
)
{
_
.
each
(
rooms
,
function
(
room
)
{
room
.
save
(
{
'
connection_status
'
:
ROOMSTATUS
.
DISCONNECTED
});
utils
.
safeSave
(
room
,
{
'
connection_status
'
:
ROOMSTATUS
.
DISCONNECTED
});
});
});
this
.
__super__
.
_tearDown
.
call
(
this
,
arguments
);
this
.
__super__
.
_tearDown
.
call
(
this
,
arguments
);
},
},
...
@@ -419,7 +419,7 @@
...
@@ -419,7 +419,7 @@
},
},
clearUnreadMsgCounter
:
function
()
{
clearUnreadMsgCounter
:
function
()
{
utils
.
sa
veWithFallback
(
this
,
{
utils
.
sa
feSave
(
this
,
{
'
num_unread
'
:
0
,
'
num_unread
'
:
0
,
'
num_unread_general
'
:
0
'
num_unread_general
'
:
0
});
});
...
@@ -1259,11 +1259,10 @@
...
@@ -1259,11 +1259,10 @@
if
(
_converse
.
connection
.
connected
)
{
if
(
_converse
.
connection
.
connected
)
{
this
.
sendUnavailablePresence
(
exit_msg
);
this
.
sendUnavailablePresence
(
exit_msg
);
}
}
if
(
utils
.
isPersistableModel
(
this
.
model
))
{
utils
.
safeSave
(
this
.
model
.
save
(
'
connection_status
'
,
ROOMSTATUS
.
DISCONNECTED
);
this
.
model
,
}
else
{
{
'
connection_status
'
:
ROOMSTATUS
.
DISCONNECTED
}
this
.
model
.
set
(
'
connection_status
'
,
ROOMSTATUS
.
DISCONNECTED
);
);
}
this
.
removeHandlers
();
this
.
removeHandlers
();
_converse
.
ChatBoxView
.
prototype
.
close
.
apply
(
this
,
arguments
);
_converse
.
ChatBoxView
.
prototype
.
close
.
apply
(
this
,
arguments
);
},
},
...
@@ -1276,7 +1275,8 @@
...
@@ -1276,7 +1275,8 @@
* either submitted the form, or canceled it.
* either submitted the form, or canceled it.
*
*
* Parameters:
* Parameters:
* (XMLElement) stanza: The IQ stanza containing the room config.
* (XMLElement) stanza: The IQ stanza containing the room
* config.
*/
*/
var
that
=
this
,
var
that
=
this
,
$body
=
this
.
$
(
'
.chatroom-body
'
);
$body
=
this
.
$
(
'
.chatroom-body
'
);
...
...
src/utils.js
View file @
36e078c9
...
@@ -526,11 +526,11 @@
...
@@ -526,11 +526,11 @@
return
model
.
collection
&&
model
.
collection
.
browserStorage
;
return
model
.
collection
&&
model
.
collection
.
browserStorage
;
}
}
utils
.
sa
veWithFallback
=
function
(
model
,
attr
s
)
{
utils
.
sa
feSave
=
function
(
model
,
attribute
s
)
{
if
(
utils
.
isPersistableModel
(
this
))
{
if
(
utils
.
isPersistableModel
(
model
))
{
model
.
save
(
attrs
);
model
.
save
(
attr
ibute
s
);
}
else
{
}
else
{
model
.
set
(
attrs
);
model
.
set
(
attr
ibute
s
);
}
}
}
}
return
utils
;
return
utils
;
...
...
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