diff --git a/client/js/models/comment.js b/client/js/models/comment.js index d65e13b..702370c 100644 --- a/client/js/models/comment.js +++ b/client/js/models/comment.js @@ -6,14 +6,7 @@ const events = require('../events.js'); class Comment extends events.EventTarget { constructor() { super(); - this._id = null; - this._postId = null; - this._text = null; - this._user = null; - this._creationTime = null; - this._lastEditTime = null; - this._score = null; - this._ownScore = null; + this._updateFromResponse({}); } static create(postId) { diff --git a/client/js/models/post.js b/client/js/models/post.js index fb60683..b0d2a47 100644 --- a/client/js/models/post.js +++ b/client/js/models/post.js @@ -9,30 +9,8 @@ const misc = require('../util/misc.js'); class Post extends events.EventTarget { constructor() { super(); - this._orig = {}; - - this._id = null; - this._type = null; - this._mimeType = null; - this._creationTime = null; - this._user = null; - this._safety = null; - this._contentUrl = null; - this._thumbnailUrl = null; - this._canvasWidth = null; - this._canvasHeight = null; - this._fileSize = null; - - this._flags = []; - this._tags = []; - this._notes = []; - this._comments = []; - this._relations = []; - - this._score = null; - this._favoriteCount = null; - this._ownScore = null; - this._ownFavorite = null; + this._orig = {}; + this._updateFromResponse({}); } get id() { return this._id; } diff --git a/client/js/models/tag.js b/client/js/models/tag.js index 32db964..c07f495 100644 --- a/client/js/models/tag.js +++ b/client/js/models/tag.js @@ -7,19 +7,8 @@ const misc = require('../util/misc.js'); class Tag extends events.EventTarget { constructor() { super(); - this._orig = {}; - - this._origName = null; - this._category = null; - this._description = null; - - this._names = []; - this._suggestions = []; - this._implications = []; - - this._postCount = null; - this._creationTime = null; - this._lastEditTime = null; + this._orig = {}; + this._updateFromResponse({}); } get names() { return this._names; } 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; }