mirror of
https://github.com/discourse/discourse.git
synced 2025-03-26 01:49:25 +08:00
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 we found the current session
|
||||||
if (property) {
|
if (typeof property !== "undefined") {
|
||||||
if (value) {
|
if (typeof value !== "undefined") {
|
||||||
this.currentSession.set(property, value);
|
this.currentSession.set(property, value);
|
||||||
} else {
|
} else {
|
||||||
return this.currentSession.get(property);
|
return this.currentSession.get(property);
|
||||||
|
@ -301,7 +301,7 @@ Discourse.User.reopenClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we found the current user
|
// If we found the current user
|
||||||
if (this.currentUser && property) {
|
if (this.currentUser && (typeof property !== "undefined")) {
|
||||||
return this.currentUser.get(property);
|
return this.currentUser.get(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ test('current', function(){
|
|||||||
Discourse.Session.current('orange', 'juice');
|
Discourse.Session.current('orange', 'juice');
|
||||||
equal(session.get('orange'), "juice", "it can be updated");
|
equal(session.get('orange'), "juice", "it can be updated");
|
||||||
|
|
||||||
|
Discourse.Session.current('zero', 0);
|
||||||
|
equal(session.get('zero'), 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('highestSeenByTopic', function() {
|
test('highestSeenByTopic', function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user