launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #01140
Re: [Branch ~launchpad-pqm/launchpad/devel] Rev 9596: [r=barry][ui=rs][bug=114710] It is now always possible to comment on
Hey, could the button label say "Just add a comment" and be the third
option? What do you think, Martin?
On Tue, Sep 29, 2009 at 04:21:21PM -0000, noreply@xxxxxxxxxxxxx wrote:
> Merge authors:
> Gavin Panella (allenap)
> Related merge proposals:
> https://code.launchpad.net/~allenap/launchpad/just-comment-on-question-bug-114710/+merge/12405
> proposed by: Gavin Panella (allenap)
> review: Approve - Barry Warsaw (barry)
> ------------------------------------------------------------
> revno: 9596 [merge]
> committer: Launchpad Patch Queue Manager <launchpad@xxxxxxxxxxxxxxxxx>
> branch nick: launchpad
> timestamp: Tue 2009-09-29 17:18:44 +0100
> message:
> [r=barry][ui=rs][bug=114710] It is now always possible to comment on
> a question without causing a status change. Previously every
> action implied a status change.
> modified:
> lib/lp/answers/browser/question.py
> lib/lp/answers/browser/tests/views.txt
> lib/lp/answers/stories/question-edit.txt
> lib/lp/answers/stories/question-obfuscation.txt
> lib/lp/answers/stories/question-reject-and-change-status.txt
> lib/lp/answers/stories/question-workflow.txt
> lib/lp/answers/stories/this-is-a-faq.txt
> lib/lp/answers/templates/question-index.pt
>
>
> --
> lp:launchpad/devel
> https://code.launchpad.net/~launchpad-pqm/launchpad/devel
>
> You are subscribed to branch lp:launchpad/devel.
> To unsubscribe from this branch go to https://code.launchpad.net/~launchpad-pqm/launchpad/devel/+edit-subscription.
> === modified file 'lib/lp/answers/browser/question.py'
> --- lib/lp/answers/browser/question.py 2009-09-24 11:10:26 +0000
> +++ lib/lp/answers/browser/question.py 2009-09-28 09:11:17 +0000
> @@ -639,7 +639,12 @@
> self.context.setStatus(self.user, data['status'], data['message'])
> self.request.response.addNotification(
> _('Question status updated.'))
> - self.request.response.redirect(canonical_url(self.context))
> +
> + @property
> + def next_url(self):
> + return canonical_url(self.context)
> +
> + cancel_url = next_url
>
>
> class QuestionEditView(QuestionSupportLanguageMixin, LaunchpadEditFormView):
> @@ -678,11 +683,16 @@
> editable_fields.append(field.__name__)
> self.form_fields = self.form_fields.select(*editable_fields)
>
> - @action(u"Continue", name="change")
> + @action(_("Save Changes"), name="change")
> def change_action(self, action, data):
> """Update the Question from the request form data."""
> self.updateContextFromData(data)
> - self.request.response.redirect(canonical_url(self.context))
> +
> + @property
> + def next_url(self):
> + return canonical_url(self.context)
> +
> + cancel_url = next_url
>
>
> class QuestionRejectView(LaunchpadFormView):
> @@ -701,15 +711,12 @@
> self.setFieldError(
> 'message', _('You must provide an explanation message.'))
>
> - @action(_('Reject'))
> + @action(_('Reject Question'), name="reject")
> def reject_action(self, action, data):
> """Reject the Question."""
> self.context.reject(self.user, data['message'])
> self.request.response.addNotification(
> _('You have rejected this question.'))
> - self.request.response.redirect(canonical_url(self.context))
> - return ''
> -
>
> def initialize(self):
> """See `LaunchpadFormView`.
> @@ -724,6 +731,12 @@
>
> LaunchpadFormView.initialize(self)
>
> + @property
> + def next_url(self):
> + return canonical_url(self.context)
> +
> + cancel_url = next_url
> +
>
> class LinkFAQMixin:
> """Mixin that contains common functionality for views linking a FAQ."""
> @@ -814,12 +827,10 @@
> def canAddComment(self, action):
> """Return whether the comment action should be displayed.
>
> - Comments (message without a status change) can be added when the
> - question is solved or invalid
> + Comments (message without a status change) can be added at any
> + time by any logged-in user.
> """
> - return (self.user is not None and
> - self.context.status in [
> - QuestionStatus.SOLVED, QuestionStatus.INVALID])
> + return self.user is not None
>
> @action(_('Add Comment'), name='comment', condition=canAddComment)
> def comment_action(self, action, data):
> @@ -1090,9 +1101,7 @@
> """View to create a new FAQ."""
>
> schema = IFAQ
> -
> - page_title = _('Create a new FAQ')
> - label = page_title
> + label = _('Create a new FAQ')
>
> @property
> def page_title(self):
> @@ -1303,10 +1312,15 @@
> if self.context.faq == data.get('faq'):
> self.setFieldError('faq', _("You didn't modify the linked FAQ."))
>
> - @action(_('Link FAQ'), name="link")
> + @action(_('Link to FAQ'), name="link")
> def link_action(self, action, data):
> """Link the selected FAQ to the question."""
> if data['faq'] is not None:
> data['message'] += '\n' + self.getFAQMessageReference(data['faq'])
> self.context.linkFAQ(self.user, data['faq'], data['message'])
> - self.next_url = canonical_url(self.context)
> +
> + @property
> + def next_url(self):
> + return canonical_url(self.context)
> +
> + cancel_url = next_url
>
> === modified file 'lib/lp/answers/browser/tests/views.txt'
> --- lib/lp/answers/browser/tests/views.txt 2009-09-19 14:36:11 +0000
> +++ lib/lp/answers/browser/tests/views.txt 2009-09-28 09:11:17 +0000
> @@ -102,21 +102,21 @@
> >>> getAvailableActionNames(workflow_harness.view)
> []
>
> -When question is in the OPEN state, the owner can either answer his own
> -question or provide more information.
> +When question is in the OPEN state, the owner can comment, answer his
> +own question or provide more information.
>
> >>> login('test@xxxxxxxxxxxxx')
> >>> workflow_harness.submit('', {})
> >>> getAvailableActionNames(workflow_harness.view)
> - ['giveinfo', 'selfanswer']
> + ['comment', 'giveinfo', 'selfanswer']
>
> -But when another user sees the question, he can provide an answer or
> -request for more information.
> +But when another user sees the question, he can comment, provide an
> +answer or request more information.
>
> >>> login('no-priv@xxxxxxxxxxxxx')
> >>> workflow_harness.submit('', {})
> >>> getAvailableActionNames(workflow_harness.view)
> - ['answer', 'requestinfo']
> + ['answer', 'comment', 'requestinfo']
>
> When the other user requests for more information, a confirmation is
> displayed, the question status is changed to NEEDSINFO and the user is
> @@ -141,18 +141,18 @@
> >>> len(pop_notifications())
> 1
>
> -The available actions for that other user are still between giving an
> -answer or requesting for more information:
> +The available actions for that other user are still comment, give an
> +answer or request more information:
>
> >>> getAvailableActionNames(workflow_harness.view)
> - ['answer', 'requestinfo']
> + ['answer', 'comment', 'requestinfo']
>
> -And the question owner still has the same possibilities then initially:
> +And the question owner still has the same possibilities as at first:
>
> >>> login('test@xxxxxxxxxxxxx')
> >>> workflow_harness.submit('', {})
> >>> getAvailableActionNames(workflow_harness.view)
> - ['giveinfo', 'selfanswer']
> + ['comment', 'giveinfo', 'selfanswer']
>
> If he replies with the requested information, the question is moved back
> to the OPEN state.
> @@ -185,14 +185,15 @@
> >>> workflow_harness.redirectionTarget()
> '.../+question/2'
>
> -Once the question is answered, the set of possible actions for the question
> -owner changes. He can now either confirm the answer, answer the problem
> -himself, or reopen the request because that answer isn't working.
> +Once the question is answered, the set of possible actions for the
> +question owner changes. He can now either comment, confirm the answer,
> +answer the problem himself, or reopen the request because that answer
> +isn't working.
>
> >>> login('test@xxxxxxxxxxxxx')
> >>> workflow_harness.submit('', {})
> >>> getAvailableActionNames(workflow_harness.view)
> - ['confirm', 'reopen', 'selfanswer']
> + ['comment', 'confirm', 'reopen', 'selfanswer']
>
> Let's say he confirms the previous answer, in this case, the question will
> move to the 'SOLVED' state. Note that the UI doesn't enable the user to
>
> === modified file 'lib/lp/answers/stories/question-edit.txt'
> --- lib/lp/answers/stories/question-edit.txt 2009-09-24 13:45:05 +0000
> +++ lib/lp/answers/stories/question-edit.txt 2009-09-28 09:11:17 +0000
> @@ -11,8 +11,13 @@
>
> >>> user_browser.open('http://launchpad.dev/firefox/+question/2')
> >>> user_browser.getLink('Edit question').click()
> - >>> user_browser.url
> - '.../firefox/+question/2/+edit'
> + >>> print user_browser.url
> + http://answers.launchpad.dev/firefox/+question/2/+edit
> +
> +There is a cancel link should the user decide otherwise:
> +
> + >>> print user_browser.getLink('Cancel').url
> + http://answers.launchpad.dev/firefox/+question/2
>
> When we post the form, we should be redirected back to the question page.
>
> @@ -22,10 +27,10 @@
> >>> user_browser.getControl('Description').value = description
> >>> summary = "Problem showing the SVG demo on W3C web site"
> >>> user_browser.getControl('Summary').value = summary
> - >>> user_browser.getControl('Continue').click()
> + >>> user_browser.getControl('Save Changes').click()
>
> - >>> user_browser.url
> - '.../firefox/+question/2'
> + >>> print user_browser.url
> + http://answers.launchpad.dev/firefox/+question/2
>
> And viewing that page should show the updated information.
>
> @@ -61,7 +66,7 @@
> >>> user_browser.getLink('Edit question').click()
> >>> user_browser.getControl(
> ... name='field.target.package').value = 'linux-source-2.6.15'
> - >>> user_browser.getControl('Continue').click()
> + >>> user_browser.getControl('Save Changes').click()
>
> Product questions ignore sourcepackage information if it is submitted:
>
> @@ -69,7 +74,7 @@
> >>> user_browser.getLink('Edit question').click()
> >>> user_browser.getControl(
> ... name='field.target.package').value = 'linux-source-2.6.15'
> - >>> user_browser.getControl('Continue').click()
> + >>> user_browser.getControl('Save Changes').click()
>
>
> == Changing Other Metadata ==
> @@ -85,7 +90,7 @@
>
> >>> browser.getControl('Assignee').value = 'name16'
> >>> browser.getControl('Status Whiteboard').value = 'Some note'
> - >>> browser.getControl('Continue').click()
> + >>> browser.getControl('Save Changes').click()
>
> >>> soup = find_main_content(browser.contents)
> >>> print soup.first('b', text='Whiteboard:').findNext('td').renderContents()
>
> === modified file 'lib/lp/answers/stories/question-obfuscation.txt'
> --- lib/lp/answers/stories/question-obfuscation.txt 2009-09-23 14:40:53 +0000
> +++ lib/lp/answers/stories/question-obfuscation.txt 2009-09-28 09:11:17 +0000
> @@ -51,7 +51,7 @@
> >>> user_browser.getControl(name='field.faq-query').value = 'voip'
> >>> user_browser.getControl('Search', index=0).click()
> >>> user_browser.getControl('4').selected = True
> - >>> user_browser.getControl('Link FAQ').click()
> + >>> user_browser.getControl('Link to FAQ').click()
> >>> user_browser.getLink('How can I make VOIP calls?').click()
> >>> print user_browser.title
> Questions : Ubuntu
>
> === modified file 'lib/lp/answers/stories/question-reject-and-change-status.txt'
> --- lib/lp/answers/stories/question-reject-and-change-status.txt 2009-09-24 13:45:05 +0000
> +++ lib/lp/answers/stories/question-reject-and-change-status.txt 2009-09-28 09:11:17 +0000
> @@ -35,6 +35,12 @@
> There is 1 error.
> You must provide an explanation message.
>
> +At this point the user might decide this is a bad idea, so there is a
> +cancel link to take him back to the question:
> +
> + >>> print admin_browser.getLink('Cancel').url
> + http://answers.launchpad.dev/firefox/+question/2
> +
> Entering an explanation message and clicking the 'Reject' button,
> will reject the question.
>
> @@ -108,6 +114,11 @@
> >>> admin_browser.getControl('Status', index=0).displayValue
> ['Invalid']
>
> +There is also a cancel link should the user decide otherwise:
> +
> + >>> print admin_browser.getLink('Cancel').url
> + http://answers.launchpad.dev/firefox/+question/2
> +
> The user needs to select a status and enter a message explaining the
> status change:
>
>
> === modified file 'lib/lp/answers/stories/question-workflow.txt'
> --- lib/lp/answers/stories/question-workflow.txt 2009-09-24 13:45:05 +0000
> +++ lib/lp/answers/stories/question-workflow.txt 2009-09-28 09:11:17 +0000
> @@ -17,11 +17,13 @@
> ... print extract_text(
> ... find_tag_by_id(contents, 'registration'))
>
> -
> >>> def find_last_comment(contents):
> ... soup = find_main_content(contents)
> ... return soup.fetch('div', 'boardCommentBody')[-1]
>
> + >>> def print_last_comment(contents):
> + ... print extract_text(find_last_comment(contents))
> +
>
> == Logging In ==
>
> @@ -69,9 +71,8 @@
>
> >>> find_request_status(support_browser.contents)
> Needs information...
> - >>> print find_last_comment(
> - ... support_browser.contents).renderContents()
> - <p>Can you provide an example of an URL displaying the problem?</p>
> + >>> print_last_comment(support_browser.contents)
> + Can you provide an example of an URL displaying the problem?
>
> Of course, if you don't add a message, clicking on the button will give
> you an error.
> @@ -82,6 +83,25 @@
> Please enter a message.
>
>
> +== Adding a Comment ==
> +
> +A comment can be added at any point without altering the status. The
> +user simply enters the comment in the 'Message' box and clicks the
> +'Add Comment' button.
> +
> + >>> support_browser.getControl('Message').value = (
> + ... "I forgot to mention, in the meantime here is a workaround...")
> + >>> support_browser.getControl('Add Comment').click()
> +
> +This appends the comment to the question and it doesn't change its
> +status:
> +
> + >>> print find_request_status(support_browser.contents)
> + Needs information...
> + >>> print_last_comment(support_browser.contents)
> + I forgot to mention, in the meantime here is a workaround...
> +
> +
> == Answering with More Information ==
>
> When the question is in the 'Needs information' state, it means that
> @@ -109,9 +129,9 @@
>
> >>> print find_request_status(owner_browser.contents)
> Open...
> - >>> print find_last_comment(owner_browser.contents).renderContents()
> - <p>The following SVG doesn't display properly:<br />
> - <a rel="nofollow" href="http://www.w3.org/2001/08/rdfweb/rdfweb-chaals-and-dan.svg">...</a></p>
> + >>> print_last_comment(owner_browser.contents)
> + The following SVG doesn't display properly:
> + http://www.w3.org/2001/08/rdfweb/rdfweb-chaals-and-dan.svg
>
>
> == Giving an Answer ==
> @@ -132,10 +152,9 @@
>
> >>> print find_request_status(support_browser.contents)
> Answered...
> - >>> print find_last_comment(
> - ... support_browser.contents).renderContents()
> - <p>New version of the firefox package are available with SVG support
> - enabled. You can use apt-get or adept to upgrade.</p>
> + >>> print_last_comment(support_browser.contents)
> + New version of the firefox package are available with SVG support
> + enabled. You can use apt-get or adept to upgrade.
>
>
> == Confirming an Answer ==
> @@ -175,8 +194,8 @@
> Since no message can be provided when that button is clicked. A default
> confirmation message was appended to the question discussion:
>
> - >>> print find_last_comment(owner_browser.contents).renderContents()
> - <p>Thanks No Privileges Person, that solved my question.</p>
> + >>> print_last_comment(owner_browser.contents)
> + Thanks No Privileges Person, that solved my question.
>
> The confirmed answer is also highlighted.
>
> @@ -199,7 +218,7 @@
> Link to a FAQ
>
>
> -== Adding a Comment ==
> +== Adding another Comment ==
>
> When the question is Solved, it is still possible to add comments to it.
> The user simply enters the comment in the 'Message' box and clicks the
> @@ -214,8 +233,8 @@
>
> >>> print find_request_status(owner_browser.contents)
> Solved...
> - >>> print find_last_comment(owner_browser.contents).renderContents()
> - <p>The example now displays correctly. Thanks.</p>
> + >>> print_last_comment(owner_browser.contents)
> + The example now displays correctly. Thanks.
>
>
> == Reopening ==
> @@ -237,11 +256,11 @@
>
> >>> print find_request_status(owner_browser.contents)
> Open...
> - >>> print find_last_comment(owner_browser.contents).renderContents()
> - <p>Actually, there are still SVGs that do not display correctly.
> - For example, the following<br />
> - <a rel="nofollow" href="http://people.w3.org/maxf/ChessGML/immortal.svg">...</a> doesn't
> - display correctly.</p>
> + >>> print_last_comment(owner_browser.contents)
> + Actually, there are still SVGs that do not display correctly.
> + For example, the following
> + http://people.w3.org/maxf/ChessGML/immortal.svg doesn't
> + display correctly.
>
> This also removes the highlighting from the previous answer and sets
> the answerer back to None.
> @@ -346,6 +365,7 @@
> ... new_status = cells[3].renderContents()
> ... print who.lstrip(' '), action, new_status
> No Privileges Person Request for more information Needs information
> + No Privileges Person Comment Needs information
> Sample Person Give more information Open
> No Privileges Person Answer Answered
> Sample Person Confirm Solved
>
> === modified file 'lib/lp/answers/stories/this-is-a-faq.txt'
> --- lib/lp/answers/stories/this-is-a-faq.txt 2009-09-24 13:45:05 +0000
> +++ lib/lp/answers/stories/this-is-a-faq.txt 2009-09-28 09:11:17 +0000
> @@ -92,11 +92,11 @@
> >>> print user_browser.getControl('Message').value
> No Privileges Person suggests this article as an answer to your question:
>
> -He can then click 'Link FAQ' to answer the question with the selected
> +He can then click 'Link to FAQ' to answer the question with the selected
> FAQ. After clicking the button, the user is redirected to the question
> page.
>
> - >>> user_browser.getControl('Link FAQ').click()
> + >>> user_browser.getControl('Link to FAQ').click()
> >>> print user_browser.url
> http://answers.launchpad.dev/firefox/+question/2
>
> @@ -145,11 +145,11 @@
> ( ) 9: How do I troubleshoot problems with extensions/themes?
> ( ) 7: How do I install Java?
>
> -He changes the message and click 'Link FAQ'.
> +He changes the message and click 'Link to FAQ'.
>
> >>> user_browser.getControl('Message').value = (
> ... "Sorry, this document doesn't really answer your question.")
> - >>> user_browser.getControl('Link FAQ').click()
> + >>> user_browser.getControl('Link to FAQ').click()
>
> But since, he forgot to change the link, the form is displayed again
> with an error message.
> @@ -165,7 +165,7 @@
> submit the form again.
>
> >>> user_browser.getControl('No existing FAQs').selected = True
> - >>> user_browser.getControl('Link FAQ').click()
> + >>> user_browser.getControl('Link to FAQ').click()
>
> The new message was added to the question:
>
> @@ -359,7 +359,7 @@
> >>> user_browser.getControl('Search', index=0).click()
> >>> user_browser.getControl('6').selected = True
> >>> user_browser.getControl('Message').value = "The FAQ mentions this:"
> - >>> user_browser.getControl('Link FAQ').click()
> + >>> user_browser.getControl('Link to FAQ').click()
>
> The question is still solved. No Privileges Person sees the FAQ was
> added to the question, and his message was added to the question's
>
> === modified file 'lib/lp/answers/templates/question-index.pt'
> --- lib/lp/answers/templates/question-index.pt 2009-09-24 11:10:26 +0000
> +++ lib/lp/answers/templates/question-index.pt 2009-09-28 09:11:17 +0000
> @@ -143,12 +143,12 @@
> </tal:comment>
> <div class="actions" metal:fill-slot="buttons">
> <div>
> - <input tal:replace="structure view/comment_action/render" />
> <input tal:replace="structure view/answer_action/render" />
> <input tal:replace="structure view/selfanswer_action/render" />
> <input tal:replace="structure view/requestinfo_action/render" />
> <input tal:replace="structure view/giveinfo_action/render" />
> <input tal:replace="structure view/reopen_action/render" />
> + <input tal:replace="structure view/comment_action/render" />
> </div>
> <p id="answer-button-hint"
> tal:condition="view/confirm_action/available">
>
--
Christian Robottom Reis | [+55 16] 3376 0125 | http://launchpad.net/~kiko
| [+55 16] 9112 6430 | http://async.com.br/~kiko
Follow ups