[Pkg-mozext-commits] [wot] 114/226: Fixed a bug when data is submitted on opening RW for other site than previous

David Prévot taffit at moszumanska.debian.org
Fri May 1 00:35:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository wot.

commit 7c741c18d2d70ecadd60960ddd9ae636761afda2
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date:   Thu Aug 22 15:43:40 2013 +0300

    Fixed a bug when data is submitted on opening RW for other site than previous
---
 content/rw/proxies.js      | 15 ++++++++++++++-
 content/rw/ratingwindow.js |  5 ++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/content/rw/proxies.js b/content/rw/proxies.js
index 7aca0e4..5d49aba 100644
--- a/content/rw/proxies.js
+++ b/content/rw/proxies.js
@@ -156,13 +156,26 @@ var wot_bg = {    // background page object
                         obj.value[item.name] = obj.value[item.name] || {};
 
                         if (obj.value[item.name].t != state[item.name].t) {
-//                            obj.value[item.name].t  = state[item.name].t;
+                            obj.value[item.name].t  = state[item.name].t;
                             changed = true;
                             return false;   // exit the cycle
                         }
                     }
                 });
 
+                if (!wot.utils.isEmptyObject(votes)) {
+                    for (var cid in votes) {
+                        if (!obj.value.cats[cid]) {
+                            obj.value.cats[cid] = {
+                                id: cid,
+                                c: 0    // since it wasn't in the cache, then it is not identified (?)
+                            }
+                        }
+                        obj.value.cats[cid].v = votes[cid];
+                    }
+                    changed = true;
+                }
+
                 return changed;
 
             },
diff --git a/content/rw/ratingwindow.js b/content/rw/ratingwindow.js
index 48636d5..25bf024 100644
--- a/content/rw/ratingwindow.js
+++ b/content/rw/ratingwindow.js
@@ -381,7 +381,7 @@ $.extend(wot, { ratingwindow: {
             rw_title = "";
 
         /* update current rating state */
-        _this.updatestate(_this.current.target, cached);
+//        _this.updatestate(_this.current.target, cached);
         var normalized_target = cached.value.normalized ? cached.value.normalized : _this.current.target;
 
         var $_hostname = $("#hostname-text"),
@@ -545,6 +545,9 @@ $.extend(wot, { ratingwindow: {
             var bg = chrome.extension.getBackgroundPage();
 
             data = JSON.parse(data);    // for safety
+
+            _rw.updatestate(data.target, data.cached);
+
             _rw.current = data || {};
             _rw.is_registered = bg.wot.core.is_level("registered"); // update the state on every window update
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/wot.git



More information about the Pkg-mozext-commits mailing list