Merge lp:~stevenk/launchpad/information_type-notification-flag into lp:launchpad

Proposed by Steve Kowalik on 2012-05-08
Status: Merged
Approved by: Steve Kowalik on 2012-05-08
Approved revision: no longer in the source branch.
Merged at revision: 15213
Proposed branch: lp:~stevenk/launchpad/information_type-notification-flag
Merge into: lp:launchpad
Diff against target: 127 lines (+35/-10)
5 files modified
lib/lp/bugs/adapters/bugchange.py (+3/-3)
lib/lp/bugs/stories/bugs/xx-bug-activity.txt (+21/-3)
lib/lp/bugs/subscribers/bug.py (+1/-1)
lib/lp/bugs/tests/test_bugchanges.py (+3/-3)
lib/lp/services/features/flags.py (+7/-0)
To merge this branch: bzr merge lp:~stevenk/launchpad/information_type-notification-flag
Reviewer Review Type Date Requested Status
William Grant code 2012-05-08 Approve on 2012-05-08
Review via email: mp+105014@code.launchpad.net

Commit Message

Bug notifications showing information_type now use a separate feature flag.

Description of the Change

In order to make it safer and possible to switch to showing information_type in the UI for a portion of our users, switch the notifications code to using a separate feature flag.

To post a comment you must log in.
William Grant (wgrant) wrote :

I'd prefer an imperative form of the flag description (ie. "Calculate and store [...]"), but otherwise fine.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/adapters/bugchange.py'
2--- lib/lp/bugs/adapters/bugchange.py 2012-04-30 01:57:48 +0000
3+++ lib/lp/bugs/adapters/bugchange.py 2012-05-08 06:05:20 +0000
4@@ -108,7 +108,7 @@
5 # log and in notification emails.
6 bug_change_field_names = ['duplicateof', 'title', 'description']
7 if bool(getFeatureFlag(
8- 'disclosure.show_information_type_in_ui.enabled')):
9+ 'disclosure.information_type_notifications.enabled')):
10 bug_change_field_names.append('information_type')
11 else:
12 bug_change_field_names.extend(('private', 'security_related'))
13@@ -573,7 +573,7 @@
14 self.title(self.old_value), self.title(self.new_value))}
15
16
17-# XXX: This can be deleted when show_information_type_in_ui is removed.
18+# XXX: This can be deleted when information_type_notifications is removed.
19 class BugVisibilityChange(AttributeChange):
20 """Describes a change to a bug's visibility."""
21
22@@ -605,7 +605,7 @@
23 return {'text': "** Visibility changed to: %s" % visibility_string}
24
25
26-# XXX: This can be deleted when show_information_type_in_ui is removed.
27+# XXX: This can be deleted when information_type_notifications is removed.
28 class BugSecurityChange(AttributeChange):
29 """Describes a change to a bug's security setting."""
30
31
32=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-activity.txt'
33--- lib/lp/bugs/stories/bugs/xx-bug-activity.txt 2012-04-30 01:57:48 +0000
34+++ lib/lp/bugs/stories/bugs/xx-bug-activity.txt 2012-05-08 06:05:20 +0000
35@@ -322,9 +322,27 @@
36 Changes to information_type are shown when the feature flag is set.
37
38 >>> from lp.services.features.testing import FeatureFixture
39- >>> feature_flag = {
40- ... 'disclosure.show_information_type_in_ui.enabled': 'on'}
41- >>> with FeatureFixture(feature_flag):
42+ >>> feature_flags = {
43+ ... 'disclosure.information_type_notifications.enabled': 'on'}
44+ >>> with FeatureFixture(feature_flags):
45+ ... admin_browser.open(
46+ ... "http://bugs.launchpad.dev/evolution/+bug/7/+secrecy")
47+ ... admin_browser.getControl(
48+ ... "This bug report should be private").selected = True
49+ ... admin_browser.getControl('Change').click()
50+ ... admin_browser.open("http://bugs.launchpad.dev/evolution/+bug/7")
51+ ... print_comments(admin_browser.contents)
52+ Foo Bar (name16)
53+ ... ago
54+ information type:
55+ Public => User Data
56+ --------
57+
58+ >>> from lp.services.features.testing import FeatureFixture
59+ >>> feature_flags = {
60+ ... 'disclosure.show_information_type_in_ui.enabled': 'on',
61+ ... 'disclosure.information_type_notifications.enabled': 'on'}
62+ >>> with FeatureFixture(feature_flags):
63 ... admin_browser.open(
64 ... "http://bugs.launchpad.dev/jokosher/+bug/14/+secrecy")
65 ... admin_browser.getControl("User Data").selected = True
66
67=== modified file 'lib/lp/bugs/subscribers/bug.py'
68--- lib/lp/bugs/subscribers/bug.py 2012-04-27 05:56:48 +0000
69+++ lib/lp/bugs/subscribers/bug.py 2012-05-08 06:05:20 +0000
70@@ -118,7 +118,7 @@
71 changes = {}
72 fields = ["title", "description", "name"]
73 if bool(getFeatureFlag(
74- 'disclosure.show_information_type_in_ui.enabled')):
75+ 'disclosure.information_type_notifications.enabled')):
76 fields.append('information_type')
77 else:
78 fields.extend(('private', 'security_related'))
79
80=== modified file 'lib/lp/bugs/tests/test_bugchanges.py'
81--- lib/lp/bugs/tests/test_bugchanges.py 2012-05-03 01:14:29 +0000
82+++ lib/lp/bugs/tests/test_bugchanges.py 2012-05-08 06:05:20 +0000
83@@ -624,7 +624,7 @@
84 bug = self.factory.makeBug()
85 self.saveOldChanges(bug=bug)
86 feature_flag = {
87- 'disclosure.show_information_type_in_ui.enabled': 'on'}
88+ 'disclosure.information_type_notifications.enabled': 'on'}
89 bug_before_modification = Snapshot(bug, providing=providedBy(bug))
90 with FeatureFixture(feature_flag):
91 bug.transitionToInformationType(
92@@ -656,7 +656,7 @@
93 bug = self.factory.makeBug()
94 self.saveOldChanges(bug=bug)
95 feature_flags = {
96- 'disclosure.show_information_type_in_ui.enabled': 'on',
97+ 'disclosure.information_type_notifications.enabled': 'on',
98 'disclosure.display_userdata_as_private.enabled': 'on'}
99 bug_before_modification = Snapshot(bug, providing=providedBy(bug))
100 with FeatureFixture(feature_flags):
101@@ -688,7 +688,7 @@
102 bug = self.factory.makeBug(owner=person)
103 self.saveOldChanges(bug=bug)
104 feature_flag = {
105- 'disclosure.show_information_type_in_ui.enabled': 'on'}
106+ 'disclosure.information_type_notifications.enabled': 'on'}
107 webservice = launchpadlib_for('test', person)
108 lp_bug = webservice.load(api_url(bug))
109 with FeatureFixture(feature_flag):
110
111=== modified file 'lib/lp/services/features/flags.py'
112--- lib/lp/services/features/flags.py 2012-05-07 07:38:01 +0000
113+++ lib/lp/services/features/flags.py 2012-05-08 06:05:20 +0000
114@@ -320,6 +320,13 @@
115 '',
116 '',
117 ''),
118+ ('disclosure.information_type_notifications.enabled',
119+ 'boolean',
120+ ('If true, calculate and store bugchange notifications to reference '
121+ 'information_type rather than private/security_related.'),
122+ '',
123+ '',
124+ ''),
125 ])
126
127 # The set of all flag names that are documented.