Merge lp:~jcsackett/launchpad/dont-expose-domains into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | j.c.sackett | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 13114 | ||||
Proposed branch: | lp:~jcsackett/launchpad/dont-expose-domains | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
206 lines (+75/-103) 3 files modified
lib/lp/registry/doc/nickname.txt (+0/-96) lib/lp/registry/model/person.py (+1/-7) lib/lp/registry/tests/test_nickname.py (+74/-0) |
||||
To merge this branch: | bzr merge lp:~jcsackett/launchpad/dont-expose-domains | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Benji York (community) | code | Approve | |
Review via email: mp+62023@code.launchpad.net |
Commit message
[r=benji][bug=228355] Removes the use of email domain information in the creation of nicks in generate_nick
Description of the change
Summary
=======
Even though users can set lp to not show their email address, if their id has been automatically generated the email can still essentially be divulged b/c it's used to create the idea. (e.g. <email address hidden> can become bob-gmail if bob is already taken or bob-gmail-com).
This code removes the domain bit from the nick generation, as there is already a random suffix generation piece as a final fall back. If bob is already taken as a username, than the next bob@somedomain becomes bob-c or similar.
Preimplementation
=================
Spoke with Curtis Hovey
Implementation
==============
lib/lp/
-------
Removed the portion of generate_nick that used the email domain to create nicks.
lib/lp/
lib/lp/
-------
Removed the doc tests and replaced it with unittests, which are more appropriate.
Tests
=====
bin/test -t test_nickname
QA
==
Create a user on qastaging with a an email that could collide with an existing user (e.g. <email address hidden>). The domain should not be part of the generated nick.
Lint
====
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
The conversion from doctest to unittest looks like it could use some
more fleshing out.
Two of the scenarios from the doctest that look important aren't
represented in the unittests:
>>> generate_ nick("< email address hidden>") nick("< email address hidden>")
'foo-bar'
>>> generate_
'foo+bar'
The second half of the doctest (starting with "It should be nearly ionError) looks important too and those tests aren't
impossible to..." and going through the testing of
NicknameGenerat
represented in the unittests.
Here are some smaller things that occurred to me during the review:
The regex in lib/lp/ registry/ model/person. py doesn't need the second set
of capturing parens now that we're not using the domain name.
These two lines from the end of test_can_ create_ noncolliding_ nicknames
appear to be copypasta (and therefore can be removed):
self. _useNicknames( ['bar-c' ]) assertEqual( 'bar-c' , nick)
self.
It would be nice if test_enforces_ minimum_ length asserts that "i" isn't
registered at test start to ensure that we're really seeing
nick-too-short behavior and not nick-already-taken behavior.