Merge lp:~rharding/launchpad/security_banner_107842 into lp:launchpad

Proposed by Richard Harding
Status: Merged
Approved by: Richard Harding
Approved revision: no longer in the source branch.
Merged at revision: 16265
Proposed branch: lp:~rharding/launchpad/security_banner_107842
Merge into: lp:launchpad
Diff against target: 79 lines (+50/-2)
2 files modified
lib/lp/app/javascript/information_type.js (+2/-2)
lib/lp/app/javascript/tests/test_information_type.js (+48/-0)
To merge this branch: bzr merge lp:~rharding/launchpad/security_banner_107842
Reviewer Review Type Date Requested Status
Deryck Hodge (community) Approve
Review via email: mp+134187@code.launchpad.net

Commit message

Update information type javascript to not count public security as a private event.

Description of the change

Small fix to make sure we don't count public security as worthy of having the privacy banner showing with the warning.

To fix this we just update the event filters that signify what's private vs public. Adds tests for the information type values.

== QA ==

Just flip a bug from private security to public security and the banner should show/disappear.

To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/app/javascript/information_type.js'
2--- lib/lp/app/javascript/information_type.js 2012-11-12 13:45:58 +0000
3+++ lib/lp/app/javascript/information_type.js 2012-11-13 20:13:25 +0000
4@@ -59,7 +59,7 @@
5 is_private = true;
6 }
7
8- if (value.indexOf('SECURITY') !== -1) {
9+ if (value.indexOf('PRIVATESECURITY') !== -1) {
10 is_private = true;
11 }
12
13@@ -178,7 +178,7 @@
14 ns.get_banner_text = function(value) {
15 // Construct a different message for security related banner content.
16 var text;
17- if (value.indexOf('SECURITY') !== -1) {
18+ if (value.indexOf('PRIVATESECURITY') !== -1) {
19 var security_text = "This report will be private " +
20 "because it is a security " +
21 "vulnerability. You can " +
22
23=== modified file 'lib/lp/app/javascript/tests/test_information_type.js'
24--- lib/lp/app/javascript/tests/test_information_type.js 2012-11-12 13:45:58 +0000
25+++ lib/lp/app/javascript/tests/test_information_type.js 2012-11-13 20:13:25 +0000
26@@ -356,6 +356,54 @@
27 // Clean up our event since it's global to our Y instance.
28 public_ev.detach();
29 private_ev.detach();
30+ },
31+
32+ test_private_security_is_private: function () {
33+ // A value of PRIVATESECURITY counts as a private event.
34+ var called = false;
35+
36+ // However is should not fire an is_private event.
37+ var public_ev = Y.on('information_type:is_public', function (ev) {
38+ called = false;
39+ });
40+ var private_ev = Y.on('information_type:is_private', function (ev) {
41+ Y.Assert.areEqual('PRIVATESECURITY', ev.value);
42+ called = true;
43+ });
44+
45+ Y.fire('information_type:change', {
46+ value: 'PRIVATESECURITY'
47+ });
48+
49+ Y.Assert.isTrue(called, 'Did get a called event');
50+
51+ // Clean up our event since it's global to our Y instance.
52+ public_ev.detach();
53+ private_ev.detach();
54+ },
55+
56+ test_public_security_is_public: function () {
57+ // A value of PUBLICSECURITY counts as a public event.
58+ var called = false;
59+
60+ // However is should not fire an is_private event.
61+ var public_ev = Y.on('information_type:is_public', function (ev) {
62+ Y.Assert.areEqual('PUBLICSECURITY', ev.value);
63+ called = true;
64+ });
65+ var private_ev = Y.on('information_type:is_private', function (ev) {
66+ called = false;
67+ });
68+
69+ Y.fire('information_type:change', {
70+ value: 'PUBLICSECURITY'
71+ });
72+
73+ Y.Assert.isTrue(called, 'Did get a called event');
74+
75+ // Clean up our event since it's global to our Y instance.
76+ public_ev.detach();
77+ private_ev.detach();
78 }
79 }));
80