launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06575
[Merge] lp:~sinzui/launchpad/private-team-message into lp:launchpad
Curtis Hovey has proposed merging lp:~sinzui/launchpad/private-team-message into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #944881 in Launchpad itself: "team form does not state that private teams cannot be made public"
https://bugs.launchpad.net/launchpad/+bug/944881
For more details, see:
https://code.launchpad.net/~sinzui/launchpad/private-team-message/+merge/95666
Explain that private teams cannot be made public.
Pre-implementation: matsubara
Diogo noted that when creating a private team, he was not informed that
once the team is made private, the team cannot be made public. Lp should
explain this under the visibility field. Maybe it should only show (with
an info icon) if the user chooses private. This message will prevent
users from thinking that they can start a team as private, then later
make it public.
--------------------------------------------------------------------
RULES
* Update the team visibility field to indicate that private teams
cannot be made public.
* When Private is selected, show an info icon with the message to
inform the user that the decision is irreversible.
QA
* Visit https://qastaging.launchpad.net/people/+newteam
* Change the visibility to Private.
* Verify an info message appears below the field that reads:
Private teams cannot become public later.
* Change the visibility to Public.
* Verify an info message disappears.
* Change the visibility to Private.
* Verify an info message reappears
LINT
lib/lp/registry/interfaces/person.py
lib/lp/registry/javascript/team.js
lib/lp/registry/javascript/tests/test_team.html
lib/lp/registry/javascript/tests/test_team.js
TEST
./bin/test -vv -t test_team lp.registry.tests.test_yui
IMPLEMENTATION
I updated the interface docstrings. I did not need to as it turns out, but
the information didn't really reflect how private teams can be used. Since
forms do so this information I decided to revise the text.
lib/lp/registry/interfaces/person.py
I renamed the content module.visibility_changed so that it is clear it only
handles the subscription policy changes, then added a method of the same name
to orchestrate several methods. I added module.visibility_changed_visibility
to handle the extra message case. Updated module.visibility_changed tests
to also verify the message was made visible.
lib/lp/registry/javascript/team.js
lib/lp/registry/javascript/tests/test_team.html
lib/lp/registry/javascript/tests/test_team.js
--
https://code.launchpad.net/~sinzui/launchpad/private-team-message/+merge/95666
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/private-team-message into lp:launchpad.
=== modified file 'lib/lp/registry/interfaces/person.py'
--- lib/lp/registry/interfaces/person.py 2012-02-19 14:44:47 +0000
+++ lib/lp/registry/interfaces/person.py 2012-03-02 20:36:20 +0000
@@ -506,10 +506,9 @@
PRIVATE = DBItem(30, """
Private
- Only Launchpad admins and team members can view the membership list
- for this team or its name. The team roles are restricted to
- subscribing to bugs, being bug supervisor, owning code branches, and
- having a PPA.
+ Only Launchpad admins and team members can view the team's data.
+ Other users may only know of the team if it is placed
+ in a public relationship such as subscribing to a bug.
""")
@@ -695,9 +694,9 @@
visibility = exported(
Choice(title=_("Visibility"),
description=_(
- "Public visibility is standard. "
- "Private means the team is completely "
- "hidden."),
+ "Anyone can see a public team's data. Only team members "
+ "and Launchpad admins can see private team data. "
+ "Private teams cannot become public."),
required=True, vocabulary=PersonVisibility,
default=PersonVisibility.PUBLIC, readonly=True))
=== modified file 'lib/lp/registry/javascript/team.js'
--- lib/lp/registry/javascript/team.js 2012-02-16 12:34:30 +0000
+++ lib/lp/registry/javascript/team.js 2012-03-02 20:36:20 +0000
@@ -185,7 +185,7 @@
* policy choices as appropriate.
* @param visibility
*/
-module.visibility_changed = function(visibility) {
+module.visibility_changed_subscription = function(visibility) {
var widget_label = Y.one("[for=field.subscriptionpolicy]");
if (!Y.Lang.isValue(widget_label)) {
return;
@@ -215,6 +215,46 @@
module.show_subscription_policy_extra_help(widget, visibility);
};
+
+/**
+ * Show the extra help about private teams.
+ * @param visibility
+ */
+module.visibility_changed_visibility = function(visibility) {
+ var widget_label = Y.one("[for=field.visibility]");
+ if (!Y.Lang.isValue(widget_label)) {
+ return;
+ }
+ var extra_help_node = Y.one('#visibility-extra-help');
+ if (!extra_help_node) {
+ // Create the needed extra help node once.
+ var help_node = widget_label.ancestor('div').one('.formHelp');
+ extra_help_node = Y.Node.create(
+ '<div id="visibility-extra-help"></div>')
+ .addClass('sprite')
+ .addClass('info')
+ .addClass('unseen');
+ extra_help_node.set(
+ 'text', 'Private teams cannot become public later.');
+ help_node.insert(extra_help_node, 'before');
+ }
+ if (visibility === 'PRIVATE') {
+ extra_help_node.removeClass('unseen');
+ } else {
+ extra_help_node.addClass('unseen');
+ }
+};
+
+/**
+ * The team's visibility has changed so we need to update the form and
+ * explain the consequences.
+ * @param visibility
+ */
+module.visibility_changed = function(visibility) {
+ module.visibility_changed_subscription(visibility);
+ module.visibility_changed_visibility(visibility);
+};
+
/**
* Setup javascript for team adding/editing.
*/
=== modified file 'lib/lp/registry/javascript/tests/test_team.html'
--- lib/lp/registry/javascript/tests/test_team.html 2012-02-16 06:36:11 +0000
+++ lib/lp/registry/javascript/tests/test_team.html 2012-03-02 20:36:20 +0000
@@ -46,7 +46,7 @@
<tr>
<td rowspan="2"><input type="radio" value="OPEN"
name="field.subscriptionpolicy"
- id="field.subscriptionpolicy.0" class="radioType"></td>
+ id="field.subscriptionpolicy.0" class="radioType" /></td>
<td><label for="field.subscriptionpolicy.0">Open Team</label></td>
</tr>
<tr>
@@ -55,7 +55,7 @@
<tr>
<td rowspan="2"><input type="radio" value="DELEGATED"
name="field.subscriptionpolicy"
- id="field.subscriptionpolicy.1" class="radioType"></td>
+ id="field.subscriptionpolicy.1" class="radioType" /></td>
<td><label for="field.subscriptionpolicy.1">Delegated Team</label></td>
</tr>
<tr>
@@ -64,7 +64,7 @@
<tr>
<td rowspan="2"><input type="radio" value="MODERATED"
name="field.subscriptionpolicy"
- id="field.subscriptionpolicy.2" class="radioType"></td>
+ id="field.subscriptionpolicy.2" class="radioType" /></td>
<td><label for="field.subscriptionpolicy.2">Moderated Team</label></td>
</tr>
<tr>
@@ -73,7 +73,7 @@
<tr>
<td rowspan="2"><input type="radio" value="RESTRICTED"
name="field.subscriptionpolicy"
- id="field.subscriptionpolicy.3" checked="checked" class="radioType"></td>
+ id="field.subscriptionpolicy.3" checked="checked" class="radioType" /></td>
<td><label for="field.subscriptionpolicy.3">Restricted Team</label></td>
</tr>
<tr>
@@ -83,10 +83,16 @@
</div>
</div>
- <select size="1" name="field.visibility" id="field.visibility">
- <option value="PUBLIC" selected="selected">Public</option>
- <option value="PRIVATE">Private</option>
- </select>
+ <div>
+ <label for="field.visibility">Visibility:</label>
+ <div>
+ <select id="field.visibility" name="field.visibility" size="1">
+ <option selected="selected" value="PUBLIC">Public</option>
+ <option value="PRIVATE">Private</option>
+ </select>
+ </div>
+ <p class="formHelp">Help text</p>
+ </div>
</script>
</body>
</html>
=== modified file 'lib/lp/registry/javascript/tests/test_team.js'
--- lib/lp/registry/javascript/tests/test_team.js 2012-02-16 12:34:30 +0000
+++ lib/lp/registry/javascript/tests/test_team.js 2012-03-02 20:36:20 +0000
@@ -83,6 +83,11 @@
'Private teams must have a restricted subscription '+
'policy.',
extra_help.get('text'));
+ var extra_visibility_help = Y.one('#visibility-extra-help');
+ Y.Assert.isFalse(extra_visibility_help.hasClass('unseen'));
+ Y.Assert.areEqual(
+ 'Private teams cannot become public later.',
+ extra_visibility_help.get('text'));
},
// When the visibility field becomes public, all subscription policies
@@ -112,6 +117,8 @@
extra_help = Y.one('[for=field.subscriptionpolicy]')
.ancestor('div').one('.info');
Y.Assert.isNull(extra_help);
+ var extra_visibility_help = Y.one('#visibility-extra-help');
+ Y.Assert.isTrue(extra_visibility_help.hasClass('unseen'));
},
// When the subscription policy changes to private and back to public,