launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #09975
[Merge] lp:~jcsackett/launchpad/info-type-badges into lp:launchpad
j.c.sackett has proposed merging lp:~jcsackett/launchpad/info-type-badges into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1025414 in Launchpad itself: "Bug/branch privacy badge alt text is wrong/lies"
https://bugs.launchpad.net/launchpad/+bug/1025414
For more details, see:
https://code.launchpad.net/~jcsackett/launchpad/info-type-badges/+merge/115240
Summary
=======
The badge text for private bugs is no longer accurate--while anything with
a "private" info type should show the lock badge, we want to show more data
than merely "private" on hover.
Preimp
======
Spoke with Curtis Hovey.
Implementation
==============
This branch updates the bugtask badge formatter API to check what the
information type is.
In the event that it is USERDATA, and USERDATA is still being shown as private
per feature flag, it maintains the current code path. Otherwise, it sets the
alt text to the enum title, and the title (which is seen on hover) to the
enum description.
Tests for the badge html have also been updated.
Tests
=====
bin/test -vvct browser.*bugtask
QA
==
Check a bug listing with a bug that has a "private" info type. The hover over
text should show the enum description.
LoC
===
This is part of disclosure.
Lint
====
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/bugs/browser/tests/test_bugtask.py
lib/lp/app/browser/tales.py
--
https://code.launchpad.net/~jcsackett/launchpad/info-type-badges/+merge/115240
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/info-type-badges into lp:launchpad.
=== modified file 'lib/lp/app/browser/tales.py'
--- lib/lp/app/browser/tales.py 2012-07-07 14:00:30 +0000
+++ lib/lp/app/browser/tales.py 2012-07-16 22:26:31 +0000
@@ -64,6 +64,10 @@
from lp.buildmaster.enums import BuildStatus
from lp.code.interfaces.branch import IBranch
from lp.layers import LaunchpadLayer
+from lp.registry.enums import (
+ InformationType,
+ PRIVATE_INFORMATION_TYPES,
+ )
from lp.registry.interfaces.distribution import IDistribution
from lp.registry.interfaces.distributionsourcepackage import (
IDistributionSourcePackage,
@@ -71,6 +75,7 @@
from lp.registry.interfaces.person import IPerson
from lp.registry.interfaces.product import IProduct
from lp.registry.interfaces.projectgroup import IProjectGroup
+from lp.services.features import getFeatureFlag
from lp.services.utils import total_seconds
from lp.services.webapp import (
canonical_url,
@@ -956,9 +961,18 @@
def badges(self):
badges = []
- if self._context.bug.private:
- badges.append(self.icon_template % (
- "private", "Private", "sprite private"))
+ information_type = self._context.bug.information_type
+ flag = bool(
+ getFeatureFlag('disclosure.display_userdata_as_private.enabled'))
+ if information_type in PRIVATE_INFORMATION_TYPES:
+ if flag and information_type == InformationType.USERDATA:
+ badges.append(self.icon_template % (
+ "private", "Private", "sprite private"))
+ else:
+ badges.append(self.icon_template % (
+ information_type.title,
+ information_type.description,
+ "sprite private"))
if self._hasBugBranch():
badges.append(self.icon_template % (
=== modified file 'lib/lp/bugs/browser/tests/test_bugtask.py'
--- lib/lp/bugs/browser/tests/test_bugtask.py 2012-07-10 16:04:02 +0000
+++ lib/lp/bugs/browser/tests/test_bugtask.py 2012-07-16 22:26:31 +0000
@@ -2499,9 +2499,12 @@
self.assertEqual(item.bugtargetdisplayname, model['bugtarget'])
self.assertEqual('sprite product', model['bugtarget_css'])
self.assertEqual(item.bug_heat_html, model['bug_heat_html'])
- self.assertEqual(
- '<span alt="private" title="Private" class="sprite private">'
- '</span>', model['badges'])
+ self.assertTextMatchesExpressionIgnoreWhitespace(
+ '<span alt="Embargoed Security" '
+ 'title="Visible only to users with whom the project has '
+ 'shared embargoed\nsecurity information.\n" '
+ 'class="sprite private"></span>',
+ model['badges'])
self.assertEqual(None, model['milestone_name'])
item.bugtask.milestone = self.factory.makeMilestone(
product=item.bugtask.target)
Follow ups