|
|
@@ -72,14 +72,16 @@ Message.prototype.update = function(e, ts) {
|
|
|
this.edited = !!e["edited"];
|
|
|
this.removed = !!e["removed"];
|
|
|
|
|
|
- var _this = this;
|
|
|
- this.reactions = {};
|
|
|
- (e["reactions"] || []).forEach(function(r) {
|
|
|
- _this.reactions[r["name"]] = [];
|
|
|
- r["users"].forEach(function(userId) {
|
|
|
- _this.reactions[r["name"]].push(userId);
|
|
|
+ if (e["reactions"]) {
|
|
|
+ var reactions = {};
|
|
|
+ e["reactions"].forEach(function(r) {
|
|
|
+ reactions[r["name"]] = [];
|
|
|
+ r["users"].forEach(function(userId) {
|
|
|
+ reactions[r["name"]].push(userId);
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
+ this.reactions = reactions;
|
|
|
+ }
|
|
|
} else {
|
|
|
this.removed = true;
|
|
|
}
|
|
|
@@ -105,7 +107,7 @@ Message.prototype.toStatic = function() {
|
|
|
,"is_starred": this.is_starred || undefined
|
|
|
,"edited": this.edited || undefined
|
|
|
,"removed": this.removed || undefined
|
|
|
- ,"reactions": reactions.length ? reactions : undefined
|
|
|
+ ,"reactions": reactions
|
|
|
,"isMeMessage": this instanceof MeMessage || undefined
|
|
|
,"isNotice": this instanceof NoticeMessage || undefined
|
|
|
};
|