Merge lp:~rpadovani/launchpad/unhide-comments into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 17738 | ||||
Proposed branch: | lp:~rpadovani/launchpad/unhide-comments | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
153 lines (+53/-16) 5 files modified
lib/lp/answers/browser/tests/test_questionmessages.py (+4/-9) lib/lp/bugs/browser/bugtask.py (+2/-1) lib/lp/bugs/browser/tests/test_bugcomment.py (+2/-2) lib/lp/bugs/stories/bugs/xx-bug-hidden-comments.txt (+39/-4) lib/lp/coop/answersbugs/visibility.py (+6/-0) |
||||
To merge this branch: | bzr merge lp:~rpadovani/launchpad/unhide-comments | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+270950@code.launchpad.net |
Commit message
Show hidden bug comments to their owners.
Description of the change
Summary
Fix bug #1391394, impossible to unhide my comment
Proposed fix
Now owner of comments could see the comment also if it's hidden
Tests
I'm a bit confused about how implementing the test.
I see there is a TestBugCommentV
But, as far as I understand, the message created here is owned by admin.
So I think I need to create a method that creates a comment with a non-admin account, then I need to set visibility of the comment to false (comment.visible = False could work?) and then test if the comment is visible to the owner and then test if it's hide to a normal user?
Could work as approach?
The fact that you're modifying something in lib/lp/ coop/answersbug s/ should be a clue that you need to go and look in lib/lp/answers/ for users of the same test. In this case your change is going to make TestQuestionMes sageVisibility fail. As it happens, questions already behave the right way here, and there's a specific test for that. I would suggest removing TestQuestionMes sageVisibility. test_commenter_ can_see_ comments in favour of your coop test, and adjusting TestQuestionMes sageVisibility. makeHiddenMessa ge to match, something like this:
if comment_owner is None:
comment_ owner = self.factory. makePerson( ) logged_ in('admin' ): makeQuestion( ) addComment( comment_ owner, self.comment_text)
removeSecurity Proxy(comment) .message. visible = False
with celebrity_
question = self.factory.
comment = question.
return question
The other thing you need to do is to do something about the presentation. Users should see their self-hidden comments in the same way that admins do, which requires having the adminHiddenContent class set (slightly inaccurate name, but no matter). That will require changing BugComment. show_for_ admin; you probably want to change BugComment.__init__ to save user_owns_comment as an instance attribute, and then you can test that in show_for_admin. As far as testing for that goes, you're probably best off editing the existing pagetest in lib/lp/ bugs/stories/ bugs/xx- bug-hidden- comments. txt, which is the only place that tests the presence of the adminHiddenComment class at the moment.