← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #890159 in Launchpad itself: "Privacy banner does not appear on +filebug when reporting a bug that'll be private"
  https://bugs.launchpad.net/launchpad/+bug/890159

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

Summary
=======
When filing a private bug, a small notification in the old privacy style tells you that the bug you are filing will be private. We have a nice, very visible privacy notification system in use for other private artifacts we would like to use on filebug.

This branch removes the old notification, and adds one in with the privacy notification ribbon.

Implementation
==============
This branch adds setup and display privacy notifications with custom text on the filebug templates. It can't use the usual mechanism for displaying privacy (the "private" class on the body), as that mechanism relies on the primary context of the view being private--for filebug that's the bugtarget, not the bug, and the product is not private. Instead, it uses the same isPrivate method on the view that the old notification used, but sets it as a condition to add the privacy js calls. A custom notification text is passed in via config, so the same notification text as before can be used.

The section about the privacy notification in the product story has been removed--it wasn't really testing the right thing, and is now rendered wrong. The privacy notification code has not been modified for this use, and is already tested in lib/lp/app/javascript/tests/test_privacy.js

Tests
=====
bin/test --vvct privacy

QA
==
File a bug on a product with private bugs by default. You should see the privacy ribbon informing you that the bug will be private.

Lint
====
This branch is lint free.
-- 
https://code.launchpad.net/~jcsackett/launchpad/fancy-filebug/+merge/83636
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/fancy-filebug into lp:launchpad.
=== modified file 'lib/lp/bugs/templates/bugtarget-filebug-search.pt'
--- lib/lp/bugs/templates/bugtarget-filebug-search.pt	2011-11-14 04:07:15 +0000
+++ lib/lp/bugs/templates/bugtarget-filebug-search.pt	2011-11-28 16:26:29 +0000
@@ -18,14 +18,24 @@
             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 will 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"
         tal:condition="view/extra_data_to_process"/>
   </metal:block>
 
   <div metal:fill-slot="heading">
-    <div tal:condition="view/isPrivate" id="privacy" class="aside private">
-      This report will be private, though you can disclose it later.
-    </div>
     <h2>Report a bug</h2>
   </div>
 

=== modified file 'lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt'
--- lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt	2011-04-27 14:46:58 +0000
+++ lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt	2011-11-28 16:26:29 +0000
@@ -17,12 +17,22 @@
           });
       });
     </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 will 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:block>
 
   <div metal:fill-slot="heading">
-    <div tal:condition="view/isPrivate" id="privacy" class="aside private">
-      This report will be private, though you can disclose it later.
-    </div>
     <h1>Report a bug</h1>
   </div>
 

=== modified file 'lib/lp/bugs/templates/projectgroup-filebug-search.pt'
--- lib/lp/bugs/templates/projectgroup-filebug-search.pt	2011-04-28 14:04:12 +0000
+++ lib/lp/bugs/templates/projectgroup-filebug-search.pt	2011-11-28 16:26:29 +0000
@@ -21,12 +21,22 @@
       });
       });
     </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 will 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:block>
 
   <div metal:fill-slot="heading">
-    <div tal:condition="view/isPrivate" id="privacy" class="aside private">
-      This report will be private, though you can disclose it later.
-    </div>
     <h1>Report a bug</h1>
   </div>
 

=== modified file 'lib/lp/registry/stories/product/xx-product-with-private-defaults.txt'
--- lib/lp/registry/stories/product/xx-product-with-private-defaults.txt	2011-05-04 16:25:30 +0000
+++ lib/lp/registry/stories/product/xx-product-with-private-defaults.txt	2011-11-28 16:26:29 +0000
@@ -31,15 +31,6 @@
     <BLANKLINE>
     Set a <a href="...+bugsupervisor">bug supervisor</a> for this project first.
 
-== Visual effects ==
-
-The file-a-bug page uses Launchpad's standard "private" style.
-
-    >>> user_browser.open("http://launchpad.dev/redfish/+filebug";)
-    >>> print extract_text(find_tag_by_id(user_browser.contents, 'privacy'))
-    This report will be private, though you can disclose it later.
-
-
 == Filing a new bug ==
 
 If we file a new bug in redfish: