[Pkg-mozext-commits] [wot] 158/226: Fixed #58 RW is not updated when rating is changed on scorecard

David Prévot taffit at moszumanska.debian.org
Fri May 1 00:35:46 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 8ad06074b82ed99bb8c02e650caa1a01d0d7b835
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date:   Tue Sep 10 12:45:18 2013 +0300

    Fixed #58 RW is not updated when rating is changed on scorecard
---
 content/my.js              | 1 +
 content/ratingwindow.js    | 9 +++++++++
 content/rw/ratingwindow.js | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/content/my.js b/content/my.js
index 272004c..07c8564 100644
--- a/content/my.js
+++ b/content/my.js
@@ -42,6 +42,7 @@ var wot_my_session =
 					var target = clear.getAttribute("target");
 					if (target && wot_cache.iscached(target)) {
 						wot_cache.set(target, "status", WOT_QUERY_RETRY);
+                        wot_rw.resetstate();    // tell the Rating Window to reset old user testimonies
 					}
 				});
 			}
diff --git a/content/ratingwindow.js b/content/ratingwindow.js
index 783e76d..3913242 100644
--- a/content/ratingwindow.js
+++ b/content/ratingwindow.js
@@ -184,6 +184,15 @@ var wot_rw = {
         return data;
     },
 
+    resetstate: function () {
+        // This is only needed when user rates a website via scorecard. In order to update the RW because it might have
+        // cached old testimonies already
+        var rw_wot = this.get_rw_wot();
+        if (rw_wot) {
+            rw_wot.ratingwindow.resetstate();
+        }
+    },
+
     update: function () {
         // Updates content of Rating Window. RW must be already initialized (locales, categories info, etc).
 //        wdump("RW.update()");
diff --git a/content/rw/ratingwindow.js b/content/rw/ratingwindow.js
index 121fc98..4224deb 100644
--- a/content/rw/ratingwindow.js
+++ b/content/rw/ratingwindow.js
@@ -58,6 +58,11 @@ $.extend(wot, { ratingwindow: {
         return is_rated;
     },
 
+    resetstate: function () {
+        // resets testimonies state
+        wot.ratingwindow.state = { down: -1 };
+    },
+
     updatestate: function(target, data)
     {
         var _this = wot.ratingwindow;

-- 
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