← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jcsackett/launchpad/filebug-better-info/+merge/109948

Summary
=======
We have updated most of the ui for bugs to show information type. The +filebug
privacy banner had not yet been updated--this branch does so.

Preimp
======
None, this was an obvious extension of existing work.

Imp
===
Much as in the information_type_choice.js file, a function has been created to
take the select information type and create appropriate banner text to be
passed into the code that updates the banner.

Tests
=====
bin/test -vvct filebug --layer=YUI

QA
==
File a bug; as you change the info type the banner should update accordingly.

Lint
====
This branch is lint free.

-- 
https://code.launchpad.net/~jcsackett/launchpad/filebug-better-info/+merge/109948
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/filebug-better-info into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py	2012-06-08 20:58:13 +0000
+++ lib/lp/bugs/browser/bugtarget.py	2012-06-12 22:20:26 +0000
@@ -278,6 +278,8 @@
             type.name for type in PRIVATE_INFORMATION_TYPES]
         cache.objects['show_information_type_in_ui'] = (
             self.show_information_type_in_ui)
+        cache.objects['show_userdata_as_private'] = bool(getFeatureFlag(
+            'disclosure.display_userdata_as_private.enabled'))
         cache.objects['bug_private_by_default'] = (
             IProduct.providedBy(self.context) and self.context.private_bugs)
         cache.objects['information_type_data'] = [

=== modified file 'lib/lp/bugs/javascript/filebug.js'
--- lib/lp/bugs/javascript/filebug.js	2012-06-07 12:17:48 +0000
+++ lib/lp/bugs/javascript/filebug.js	2012-06-12 22:20:26 +0000
@@ -51,12 +51,30 @@
     }
 };
 
+var get_new_banner_text = function(value) {
+    var info_type_descriptions = {
+        EMBARGOEDSECURITY: 'Embargoed Security',
+        USERDATA: 'User Data',
+        PROPRIETARY: 'Proprietary'
+    };
+
+    if (LP.cache.show_userdata_as_private) {
+        info_type_descriptions.USERDATA = 'Private'; 
+    }
+    var text_template = "This report has {info_type} information." + 
+        " You can change the information type later.";
+    value = info_type_descriptions[value];
+    return Y.Lang.substitute(text_template, {'info_type': value});
+}
+
 var setup_information_type = function() {
     var itypes_table = Y.one('.radio-button-widget');
     itypes_table.delegate('change', function() {
+        var banner_text = get_new_banner_text(this.get('value'));
         var private_type = (Y.Array.indexOf(
             LP.cache.private_types, this.get('value')) >= 0);
-        update_privacy_banner(private_type);
+        
+        update_privacy_banner(private_type, banner_text);
     }, "input[name='field.information_type']");
 };
 

=== modified file 'lib/lp/bugs/javascript/tests/test_filebug.js'
--- lib/lp/bugs/javascript/tests/test_filebug.js	2012-06-01 05:11:24 +0000
+++ lib/lp/bugs/javascript/tests/test_filebug.js	2012-06-12 22:20:26 +0000
@@ -85,8 +85,8 @@
             Y.Assert.isNull(banner_hidden);
             var banner_text = Y.one('.banner-text').get('text');
             Y.Assert.areEqual(
-                'This report will be private. ' +
-                'You can disclose it later.', banner_text);
+                'This report has Embargoed Security information. ' +
+                'You can change the information type later.', banner_text);
         },
 
         // Selecting a public info type using the legacy radio buttons
@@ -214,8 +214,8 @@
             Y.Assert.isNull(banner_hidden);
             var banner_text = Y.one('.banner-text').get('text');
             Y.Assert.areEqual(
-                'This report will be private. ' +
-                'You can disclose it later.', banner_text);
+                'This report has User Data information. ' +
+                'You can change the information type later.', banner_text);
         },
 
         // Selecting a public info type using the popup choice widget


Follow ups