Răsfoiți Sursa

[bugfix] properly update private room version

B Thibault 8 ani în urmă
părinte
comite
f2969f962f
2 a modificat fișierele cu 3 adăugiri și 3 ștergeri
  1. 1 1
      srv/src/context.js
  2. 2 2
      srv/src/slackData.js

+ 1 - 1
srv/src/context.js

@@ -12,7 +12,7 @@ function ChatInfo(id) {
 };
 
 ChatInfo.prototype.toStatic = function(t) {
-    return t >= this.version ? {} : {
+    return t >= this.version ? undefined : {
         "id": this.id
         ,"name": this.name
     };

+ 2 - 2
srv/src/slackData.js

@@ -187,7 +187,7 @@ SlackData.prototype.updateStatic = function(data, t) {
         if (user) {
             if (!this.channels[data["ims"][i]["id"]])
                 this.channels[data["ims"][i]["id"]] = new SlackIms(data["ims"][i]["id"], user);
-            this.channels[data["ims"][i]["id"]].update(data["ims"][i], t);
+            this.channels[data["ims"][i]["id"]].update(data["ims"][i], this, t);
         }
     }
     for (var i =0, nbGroups = data["groups"].length; i < nbGroups; i++) {
@@ -251,7 +251,7 @@ SlackData.prototype.onMessage = function(msg, t) {
         var channel = this.channels[msg["channel"]];
         if (channel) {
             channel.lastRead = parseFloat(msg["ts"]);
-            this.staticV = channel.version = t;
+            this.staticV = channel.version = Math.max(channel.version, t);
         }
     }
 };