aboutsummaryrefslogtreecommitdiff
path: root/client/js/models/user.js
diff options
context:
space:
mode:
authorrr-2016-07-26 21:01:52 +0200
committerrr-2016-07-26 23:15:05 +0200
commitd2a5e1056d0f33827e5b6d408cd4851264285557 (patch)
tree0921818a16bc73bac70136d7f86dfaf5d6c1f4a7 /client/js/models/user.js
parent7022686b778beb19589dc2e92846fb4051f55bdb (diff)
client/models: discard field declarations
This has important side effect that matters when we check for data changes using _orig dictionary. Previously, _orig was empty (so its members fields were undefiend) whereas the real fields were declared as nulls. This meant that for new entities, the conditions were always true, which is unintended. Now both _orig and the class itself are initially populated with _updateFromResponse which syncs the state between them, removing the problem.
Diffstat (limited to 'client/js/models/user.js')
-rw-r--r--client/js/models/user.js21
1 files changed, 1 insertions, 20 deletions
diff --git a/client/js/models/user.js b/client/js/models/user.js
index 4ebcac0..0b45866 100644
--- a/client/js/models/user.js
+++ b/client/js/models/user.js
@@ -6,26 +6,7 @@ const events = require('../events.js');
class User extends events.EventTarget {
constructor() {
super();
- this._name = null;
- this._rank = null;
- this._email = null;
- this._avatarStyle = null;
- this._avatarUrl = null;
- this._creationTime = null;
- this._lastLoginTime = null;
- this._commentCount = null;
- this._favoritePostCount = null;
- this._uploadedPostCount = null;
- this._likedPostCount = null;
- this._dislikedPostCount = null;
-
- this._origName = null;
- this._origEmail = null;
- this._origRank = null;
- this._origAvatarStyle = null;
-
- this._password = null;
- this._avatarContent = null;
+ this._updateFromResponse({});
}
get name() { return this._name; }

© 2015 - 2026 Jakob L. Kreuze