FIX: Allow Discourse.Session.current() API to update to 0

This commit is contained in:
Robin Ward 2013-08-02 18:48:02 -04:00
parent 91efbc1830
commit 8d08391ff5
3 changed files with 5 additions and 3 deletions

View file

@ -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);

View file

@ -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);
}

View file

@ -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() {