Merge lp:~jcsackett/launchpad/set-question-message-visibility into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Curtis Hovey |
Approved revision: | no longer in the source branch. |
Merged at revision: | 12765 |
Proposed branch: | lp:~jcsackett/launchpad/set-question-message-visibility |
Merge into: | lp:launchpad |
Diff against target: |
256 lines (+137/-1) 9 files modified
lib/canonical/launchpad/browser/message.py (+1/-0) lib/canonical/launchpad/security.py (+9/-0) lib/lp/answers/configure.zcml (+4/-0) lib/lp/answers/interfaces/question.py (+19/-0) lib/lp/answers/interfaces/questionmessage.py (+5/-0) lib/lp/answers/model/question.py (+5/-0) lib/lp/answers/model/questionmessage.py (+5/-0) lib/lp/answers/templates/question-index.pt (+2/-1) lib/lp/answers/tests/test_question_webservice.py (+87/-0) |
To merge this branch: | bzr merge lp:~jcsackett/launchpad/set-question-message-visibility |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Curtis Hovey (community) | code | Approve | |
Launchpad code reviewers | Pending | ||
Review via email: mp+56588@code.launchpad.net |
This proposal supersedes a proposal from 2011-03-23.
Commit message
[r=sinzui][bug=45419] Adds a method via the API to hide question comments.
Description of the change
NB: This is a resubmit to re-land this branch on devel; previously it was landed against db-devel, but that branch was not qa'ed in time for deployment. The branch that this previously depended on was deployed successfully, so this can now be easily landed on devel. See previous MP for discussion and approval for landing on db-devel.
Summary
=======
As part of ongoing Maintenance and spam work, this branch adds a means of hiding comments on questions to silence question spam via the API.
There may be some noise because of the dependent branch including some bits not included in this branch. To get around the noise of those bits, you should look at http://
Implementation
==============
I've added a new method to Question, setCommentVisib
It's security is set to launchpad.Moderate, as set in the configure.zcml, with an adapter in the main security.py file.
Tests
=====
bin/test -t answers.
QA
==
Hide a comment using the API; it shouldn't be visible on the answers page. Setting visible back to True should show it on the answers page.
Lint
====
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/canonical
lib/canonical
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
Hi JC.
I am very excited to see Questions over the API. I have a few trivial requests and a question.
The setCommentVisib ility method's docstring does not conform to PEP 257. I expect to see a single line with an optional paragraph of further information.
IQuestion.priority is unused. We do not want this exported.
I do not see a security checker set for IQuestionMessage in security.py. In the past, this prevented anonymous users from getting the object. That is to say question.messages is always an empty list. Is this true when you access the list as anon? The fix to security.py is pretty trivial:
{{{ sage(AnonymousA uthorization) :
class ViewQuestionMes
"""Anyone can view an IQustionMessage."""
usedfor = IQuestionMessage
}}}
However, I think this will show visible and hidden the comments over the API. I am unsure if this is an issue. You may want to override the checkUnauthenti cated() method.