FIX: Allow `Discourse.Session.current()` API to update to 0
This commit is contained in:
parent
91efbc1830
commit
8d08391ff5
|
@ -27,8 +27,8 @@ Discourse.Session.reopenClass({
|
|||
}
|
||||
|
||||
// If we found the current session
|
||||
if (property) {
|
||||
if (value) {
|
||||
if (typeof property !== "undefined") {
|
||||
if (typeof value !== "undefined") {
|
||||
this.currentSession.set(property, value);
|
||||
} else {
|
||||
return this.currentSession.get(property);
|
||||
|
|
|
@ -301,7 +301,7 @@ Discourse.User.reopenClass({
|
|||
}
|
||||
|
||||
// If we found the current user
|
||||
if (this.currentUser && property) {
|
||||
if (this.currentUser && (typeof property !== "undefined")) {
|
||||
return this.currentUser.get(property);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ test('current', function(){
|
|||
Discourse.Session.current('orange', 'juice');
|
||||
equal(session.get('orange'), "juice", "it can be updated");
|
||||
|
||||
Discourse.Session.current('zero', 0);
|
||||
equal(session.get('zero'), 0);
|
||||
});
|
||||
|
||||
test('highestSeenByTopic', function() {
|
||||
|
|
Loading…
Reference in New Issue