Merge lp:~sinzui/launchpad/ask-question-from-bug into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 14074
Proposed branch: lp:~sinzui/launchpad/ask-question-from-bug
Merge into: lp:launchpad
Diff against target: 0 lines
To merge this branch: bzr merge lp:~sinzui/launchpad/ask-question-from-bug
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Review via email: mp+77562@code.launchpad.net

Description of the change

Disable ask/convert to question in Bugs when the project does not use Answers.

    Launchpad bug: https://bugs.launchpad.net/bugs/860565
    Pre-implementation: No one

If some project has not enabled answers then user still can ask questions
clicking on Bugs tab using the "Ask a question" link.

I saw this bug reported and knew it could be fixed in a few minutes. I also
realised that the convert to question rules probably ignored Answers too.

--------------------------------------------------------------------

RULES

    * Update the view to return None for the addquestion URL when the
      pillar does not use Answers.
    * Update the canBeAQuestion() method to check that the pillar uses
      answers.

QA

    * Visit https://bugs.qastaging.launchpad.net/bzr-tiplog
    * Verify "Ask a question" is not an action in the side bar.
    * Visit any bug with only one task
    * Verify the "Convert to question" action is not in the side bar.

LINT

    lib/lp/bugs/browser/bugtask.py
    lib/lp/bugs/browser/tests/test_buglisting.py
    lib/lp/bugs/model/bug.py
    lib/lp/bugs/tests/bugtarget-questiontarget.txt
    lib/lp/bugs/tests/test_bugtarget.py

TEST

    ./bin/test -vvc -t TestBugTaskSearchListingViewProduct \
        lp.bugs.browser.tests.test_buglisting
    ./bin/test -vvc lp.bugs.tests.test_bugtarget

IMPLEMENTATION

Return None for in addquestion_url() when the pillar does not use Answers.
    lib/lp/bugs/browser/bugtask.py
    lib/lp/bugs/browser/tests/test_buglisting.py

Return False for in canBeAQuestion() when the pillar does not use Answers.
Adding a new test to bugtarget-questiontarget.txt broke the mail checks in
the test. I decided to replace the section in the doctest with a unittest.
    lib/lp/bugs/model/bug.py
    lib/lp/bugs/tests/bugtarget-questiontarget.txt
    lib/lp/bugs/tests/test_bugtarget.py

To post a comment you must log in.
Revision history for this message
j.c.sackett (jcsackett) wrote :

So, this isn't necessary to fix, but while you can set official_answers to False to make it not use launchpad, you could also set the answers_usage attribute directly with a value from the ServiceUsage enum, which is more in line with how the code elsewhere sets it (or is *supposed* to set it, in any event).

review: Approve

Preview Diff

Empty