← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~andrey-fedoseev/launchpad:question-title into launchpad:master

 

Andrey Fedoseev has proposed merging ~andrey-fedoseev/launchpad:question-title into launchpad:master.

Commit message:
Include question title to the browser window title

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~andrey-fedoseev/launchpad/+git/launchpad/+merge/432180
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~andrey-fedoseev/launchpad:question-title into launchpad:master.
diff --git a/lib/lp/answers/browser/question.py b/lib/lp/answers/browser/question.py
index 7e5926a..65bbd94 100644
--- a/lib/lp/answers/browser/question.py
+++ b/lib/lp/answers/browser/question.py
@@ -296,6 +296,13 @@ class QuestionBreadcrumb(Breadcrumb):
     def text(self):
         return "Question #%d" % self.context.id
 
+    @property
+    def detail(self):
+        return smartquote('%s "%s"') % (
+            self.text,
+            self.context.title,
+        )
+
 
 class QuestionSetView(LaunchpadFormView):
     """View for the Answer Tracker index page."""
diff --git a/lib/lp/answers/browser/tests/test_views.py b/lib/lp/answers/browser/tests/test_views.py
index 9dd7757..c329907 100644
--- a/lib/lp/answers/browser/tests/test_views.py
+++ b/lib/lp/answers/browser/tests/test_views.py
@@ -33,7 +33,7 @@ class TestEmailObfuscated(BrowserTestCase):
         browser = self.getBrowserForQuestionWithEmail(
             email_address, no_login=False
         )
-        self.assertEqual(4, browser.contents.count(email_address))
+        self.assertEqual(6, browser.contents.count(email_address))
 
     def test_anonymous_sees_not_email_address(self):
         """The anonymous user cannot see the email address on the page."""
diff --git a/lib/lp/answers/stories/question-browse-and-search.rst b/lib/lp/answers/stories/question-browse-and-search.rst
index 90b15a7..61cc8cf 100644
--- a/lib/lp/answers/stories/question-browse-and-search.rst
+++ b/lib/lp/answers/stories/question-browse-and-search.rst
@@ -139,7 +139,7 @@ details of the question are available.
 
     >>> browser.getLink("Slow system").click()
     >>> print(browser.title)
-    Question #7 : ...
+    Question #7 “Slow system” : ...
     >>> soup = find_main_content(browser.contents)
     >>> soup("div", "report")
     [<div class="report"><p>I get really poor hard drive
@@ -161,9 +161,8 @@ to jump to the question.
     >>> browser.open("http://answers.launchpad.test/";)
     >>> browser.getControl(name="field.search_text").value = "9"
     >>> browser.getControl("Find Answers").click()
-    >>> from lp.services.helpers import backslashreplace
-    >>> print(backslashreplace(browser.title))
-    Question #9 : ...
+    >>> print(browser.title)
+    Question #9 ...
 
 While reading the Ubuntu forums for a solution to his problem,
 Average Joe finds some unlinked text that refers to how to
@@ -174,8 +173,8 @@ the answer.
     >>> browser.open("http://answers.launchpad.test/";)
     >>> browser.getControl(name="field.search_text").value = " #6 "
     >>> browser.getControl("Find Answers").click()
-    >>> print(backslashreplace(browser.title))
-    Question #6 : ...
+    >>> print(browser.title)
+    Question #6 ...
 
 The Answer Tracker cannot identify Question ids within text. Average
 Joe finds a reference to question 8 in a blog. He copies 'question 8'
@@ -243,7 +242,7 @@ He clicks on the link to read the question description.
 
     >>> browser.getLink("Firefox is slow").click()
     >>> print(browser.title)
-    Question #3 : ...
+    Question #3 “Firefox is slow and consumes too much RAM” : ...
 
 The user must choose at least one status when searching questions. An
 error is displayed when the user forgets to select a status.
diff --git a/lib/lp/answers/stories/question-message.rst b/lib/lp/answers/stories/question-message.rst
index c6ca281..f733968 100644
--- a/lib/lp/answers/stories/question-message.rst
+++ b/lib/lp/answers/stories/question-message.rst
@@ -12,9 +12,6 @@ an email post to examine the markup rules. This message contains a
 quoted passage, and a signature with an email address in it.
 
     >>> user_browser.open("http://answers.launchpad.test/ubuntu/+question/11";)
-    >>> print(user_browser.title)
-    Question #11 : ...
-
     >>> user_browser.getControl("Message").value = (
     ...     "Top quoting is bad netiquette.\n"
     ...     "The leading text will be displayed\n"
@@ -39,8 +36,6 @@ Email addresses are only shown to authenticated users
 Email addresses are visible to authenticated users. Sample Person is
 authenticated already, so they will see 'human@xxxxxxxxxxxxx'.
 
-    >>> print(user_browser.title)
-    Question #11 :  ...
     >>> text = find_tags_by_class(user_browser.contents, "boardCommentBody")[
     ...     -1
     ... ]
@@ -55,9 +50,6 @@ of 'person@xxxxxxxxxx'. The anonymous user is unauthenticated, so they will
 see the obfuscated email address (<email address hidden>).
 
     >>> anon_browser.open("http://answers.launchpad.test/ubuntu/+question/11";)
-    >>> print(anon_browser.title)
-    Question #11 : ...
-
     >>> text = find_tags_by_class(anon_browser.contents, "boardCommentBody")[
     ...     -1
     ... ]
diff --git a/lib/lp/answers/stories/question-overview.rst b/lib/lp/answers/stories/question-overview.rst
index 612ee94..9f1d807 100644
--- a/lib/lp/answers/stories/question-overview.rst
+++ b/lib/lp/answers/stories/question-overview.rst
@@ -59,7 +59,7 @@ question page.
 
     >>> browser.getLink("Problem showing the SVG demo on W3C site").click()
     >>> print(browser.title)
-    Question #2 : ...
+    Question #2 “Problem showing the SVG demo on W3C site” : ...
 
     >>> print(
     ...     find_main_content(browser.contents).find("h1").decode_contents()
diff --git a/lib/lp/answers/stories/this-is-a-faq.rst b/lib/lp/answers/stories/this-is-a-faq.rst
index 948c5fa..1ccb2ba 100644
--- a/lib/lp/answers/stories/this-is-a-faq.rst
+++ b/lib/lp/answers/stories/this-is-a-faq.rst
@@ -35,14 +35,12 @@ For example, No Privileges Person comes across a question about SVG
 support in Firefox. That question has a well-known answer, so they click
 on 'Link to a FAQ' to answer the question:
 
-    # We use backslashreplace because the page title includes smart quotes.
-    >>> from lp.services.helpers import backslashreplace
     >>> user_browser.open("http://answers.launchpad.test/firefox/+question/2";)
-    >>> print(backslashreplace(user_browser.title))
-    Question #2 : ...
+    >>> print(user_browser.title)
+    Question #2 ...
 
     >>> user_browser.getLink("Link to a FAQ").click()
-    >>> print(backslashreplace(user_browser.title))
+    >>> print(user_browser.title)
     Is question #2 a FAQ...
 
 This page lists the existing FAQs matching the question's title. In
@@ -143,6 +141,7 @@ A link to the FAQ appears under the question's description:
 
 The answer message was added to the question's discussion:
 
+    >>> from lp.services.helpers import backslashreplace
     >>> print(
     ...     backslashreplace(
     ...         extract_text(
@@ -389,7 +388,7 @@ can also be linked to FAQs.
 
     >>> user_browser.open("http://answers.launchpad.test/ubuntu/+question/11";)
     >>> print(user_browser.title)
-    Question #11 : ...
+    Question #11 ...
     >>> user_browser.getLink("Link to a FAQ").click()
     >>> print(user_browser.title)
     Is question #11 a FAQ...
@@ -399,7 +398,7 @@ can also be linked to FAQs.
     ...     "/+question/8"
     ... )
     >>> print(user_browser.title)
-    Question #8 : ...
+    Question #8 ...
     >>> user_browser.getLink("Link to a FAQ").click()
     >>> user_browser.title
     'Is question #8 a FAQ...
@@ -439,7 +438,7 @@ added to the question, and their message was added to the question's
 discussion.
 
     >>> print(user_browser.title)
-    Question #9 : ...
+    Question #9 ...
     >>> print_question_status(user_browser)
     Status: Solved