[Pkg-mozext-commits] [requestpolicy] 89/100: fix #514

David Prévot taffit at moszumanska.debian.org
Fri Dec 12 22:57:02 UTC 2014


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

taffit pushed a commit to branch master
in repository requestpolicy.

commit 9a7d9a9fe9195f21779023a4a30babfaa7c04ad5
Author: Martin Kimmerle <dev at 256k.de>
Date:   Tue Nov 11 23:00:45 2014 +0100

    fix #514
---
 src/content/settings/yourpolicy.js | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/content/settings/yourpolicy.js b/src/content/settings/yourpolicy.js
index 05e0147..5ddcf97 100644
--- a/src/content/settings/yourpolicy.js
+++ b/src/content/settings/yourpolicy.js
@@ -82,6 +82,9 @@ function addRules(entries, source, filter, readOnly) {
 }
 
 function deleteRule(event) {
+  // TODO: the rule should not be referenced by the rule data but by some
+  //       unique identifier. Currently, if there's exactly the same rule twice,
+  //       (one of them might be a temporary rule), both will get removed.
   var anchor = $(event.target);
   var ruleAction = anchor.data('requestpolicyRuleAction');
   var ruleData = anchor.data('requestpolicyRuleData');
@@ -103,13 +106,17 @@ function clearRulesTable(table) {
 
 function addRulesTableRow(table, ruleAction, origin, dest, ruleData, source, readOnly) {
 
-  var actionClass = ruleAction == 'allow' ? 'allow' : 'block';
-  var action = ruleAction == 'allow' ? _('allow') : _('block');
 
-  var row = $('<tr>').addClass(actionClass).appendTo(table);
+  if (ruleAction != 'allow') {
+    ruleAction = 'block';
+  }
+  ruleAction = ruleAction == 'allow' ? 'allow' : 'block';
+  var ruleActionString = ruleAction == 'allow' ? _('allow') : _('block');
+
+  var row = $('<tr>').addClass(ruleAction).appendTo(table);
 
   row.append(
-    $('<td>').text(action),
+    $('<td>').text(ruleActionString),
     $('<td>').text(origin),
     $('<td>').text(dest),
     $('<td>').text(source)
@@ -118,7 +125,7 @@ function addRulesTableRow(table, ruleAction, origin, dest, ruleData, source, rea
   if (!readOnly) {
     var anchor = $('<a>');
     anchor.text('x').addClass('deleterule');
-    anchor.data('requestpolicyRuleAction', action);
+    anchor.data('requestpolicyRuleAction', ruleAction);
     anchor.data('requestpolicyRuleData', ruleData);
     anchor.click(deleteRule);
     row.append($('<td>').append(anchor));

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



More information about the Pkg-mozext-commits mailing list