← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jcsackett/launchpad/fancy-filebug-part2 into lp:launchpad

 

j.c.sackett has proposed merging lp:~jcsackett/launchpad/fancy-filebug-part2 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jcsackett/launchpad/fancy-filebug-part2/+merge/84004

Summary
=======
Updates the filebug behavior to use the privacy notification ribbon to inform
users that the bug will be private when marked as a security vulnerability.

Preimp
=====
None -- obvious continuation of existing work.

Implementation
==============
* The code that previously showed the ribbon for private-by-default bugs on 
  +filebug has been moved into a macro in the filebug macros file. The
  templates needing it have been updated.

* In the macro, a new tal section has been added that is active for bugs which
  aren't private by default, which sets up the privacy notification with the
  security based message. It also sets a display/hide of the ribbon on the
  change event of the security_related checkbox.

Tests
=====
No new tests. Privacy banner tests can be tested via: 

firefox lib/lp/app/privacy/test_privacy.html

QA
==
File a bug on qastaging. Toggle the security_related checkbox. When checked,
the ribbon should appear. When unchecked, it should hide.

File a bug on qastaging on a project with bugs private-by-default; the privacy
ribbon should display mentioning the bugs are private by default, and toggling
the security_related checkbox should have no effect.

Lint
====

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/templates/bugtarget-filebug-search.pt
  lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt
  lib/lp/bugs/templates/bugtarget-macros-filebug.pt
  lib/lp/bugs/templates/projectgroup-filebug-search.pt
-- 
https://code.launchpad.net/~jcsackett/launchpad/fancy-filebug-part2/+merge/84004
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/fancy-filebug-part2 into lp:launchpad.
=== modified file 'lib/lp/bugs/templates/bugtarget-filebug-search.pt'
--- lib/lp/bugs/templates/bugtarget-filebug-search.pt	2011-11-28 21:08:56 +0000
+++ lib/lp/bugs/templates/bugtarget-filebug-search.pt	2011-11-30 20:04:06 +0000
@@ -18,21 +18,8 @@
             Y.lp.bugs.filebug_dupefinder.setup_dupe_finder();
         });
     </script>
-    <tal:private condition="view/isPrivate">
-        <script type="text/javascript">
-            LPS.use('lp.app.privacy',  function(Y) {
-                Y.on('domready', function() {
-                    var cfg = {
-                        notification_text: "This report till be private, "
-                            + "though you can disclose it later."
-                    };
-                    Y.lp.app.privacy.setup_privacy_notification(cfg);
-                    Y.lp.app.privacy.display_privacy_notification();
-                });
-            });
-        </script>
-    </tal:private>
-    <meta http-equiv="refresh" content="10"
+    <metal:privacy use-macro="view/@@+filebug-macros/bug-reporting-privacy" />
+   <meta http-equiv="refresh" content="10"
         tal:condition="view/extra_data_to_process"/>
   </metal:block>
 

=== modified file 'lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt'
--- lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt	2011-11-28 21:08:56 +0000
+++ lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt	2011-11-30 20:04:06 +0000
@@ -17,20 +17,7 @@
           });
       });
     </script>
-    <tal:private condition="view/isPrivate">
-        <script type="text/javascript">
-            LPS.use('lp.app.privacy',  function(Y) {
-                Y.on('domready', function() {
-                   var cfg = {
-                        notification_text: "This report till be private, "
-                            + "though you can disclose it later."
-                    };
-                    Y.lp.app.privacy.setup_privacy_notification(cfg);
-                    Y.lp.app.privacy.display_privacy_notification();
-                });
-            });
-        </script>
-    </tal:private>
+    <metal:privacy use-macro="view/@@+filebug-macros/bug-reporting-privacy"/>
   </metal:block>
 
   <div metal:fill-slot="heading">

=== modified file 'lib/lp/bugs/templates/bugtarget-macros-filebug.pt'
--- lib/lp/bugs/templates/bugtarget-macros-filebug.pt	2011-08-04 13:56:55 +0000
+++ lib/lp/bugs/templates/bugtarget-macros-filebug.pt	2011-11-30 20:04:06 +0000
@@ -327,6 +327,52 @@
   </tr>
 </metal:bug_reporting_guidelines>
 
+<metal:privacy define-macro="bug-reporting-privacy">
+    <tal:private condition="view/isPrivate">
+        <script type="text/javascript">
+            LPS.use('lp.app.privacy',  function(Y) {
+                Y.on('domready', function() {
+                   var cfg = {
+                        notification_text: "This report will be private. "
+                            + "You can disclose it later."
+                    };
+                    Y.lp.app.privacy.setup_privacy_notification(cfg);
+                    Y.lp.app.privacy.display_privacy_notification();
+                });
+            });
+        </script>
+    </tal:private>
+    <tal:not-private condition="not view/isPrivate">
+        <tal:comment replace="nothing">
+            If the bug isn't private by default, then we need to setup a
+            notifications for if the bug is marked a security bug (in which
+            case it will be private).
+        </tal:comment>
+
+        <script type="text/javascript">
+            LPS.use('lp.app.privacy', 'lp.bugs.filebug_dupefinder', function(Y) {
+                Y.on('domready', function() {
+                   var cfg = {
+                        notification_text: "This report will be private "
+                            + "because it is a security vulnerability. You "
+                            + "can disclose it later."
+                    };
+                    Y.lp.app.privacy.setup_privacy_notification(cfg);
+                    var sec = Y.one('[id="field.security_related"]');
+                    sec.on('change', function() {
+                        var checked = sec.get('checked');
+                        if (checked) {
+                            Y.lp.app.privacy.display_privacy_notification();
+                        } else {
+                            Y.lp.app.privacy.hide_privacy_notification();
+                        }
+                    });
+                });
+            });
+        </script>
+    </tal:not-private>
+</metal:privacy>
+
 <metal:similar-bugs define-macro="display-similar-bugs">
   <tal:results-intro-with-summary condition="view/show_summary_in_results">
     <p id="filebug-query-heading">

=== modified file 'lib/lp/bugs/templates/projectgroup-filebug-search.pt'
--- lib/lp/bugs/templates/projectgroup-filebug-search.pt	2011-11-28 21:08:56 +0000
+++ lib/lp/bugs/templates/projectgroup-filebug-search.pt	2011-11-30 20:04:06 +0000
@@ -21,20 +21,7 @@
       });
       });
     </script>
-    <tal:private condition="view/isPrivate">
-        <script type="text/javascript">
-            LPS.use('lp.app.privacy',  function(Y) {
-                Y.on('domready', function() {
-                    var cfg = {
-                        notification_text: "This report till be private, "
-                            + "though you can disclose it later."
-                    };
-                    Y.lp.app.privacy.setup_privacy_notification(cfg);
-                    Y.lp.app.privacy.display_privacy_notification();
-                });
-            });
-        </script>
-    </tal:private>
+    <metal:privacy use-macro="view/@@+filebug-macros/bug-reporting-privacy"/>
   </metal:block>
 
   <div metal:fill-slot="heading">


Follow ups