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

Proposed by Andrey Fedoseev
Status: Merged
Approved by: Andrey Fedoseev
Approved revision: 11686c10ca58615496e2e61495fe5ade5d4e35d3
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~andrey-fedoseev/launchpad:question-title
Merge into: launchpad:master
Diff against target: 178 lines (+22/-25)
6 files modified
lib/lp/answers/browser/question.py (+7/-0)
lib/lp/answers/browser/tests/test_views.py (+1/-1)
lib/lp/answers/stories/question-browse-and-search.rst (+6/-7)
lib/lp/answers/stories/question-message.rst (+0/-8)
lib/lp/answers/stories/question-overview.rst (+1/-1)
lib/lp/answers/stories/this-is-a-faq.rst (+7/-8)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+432180@code.launchpad.net

Commit message

Include question title to the browser window title

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

Thanks for tackling this.

For GUI related changes it would be very helpful to provide screenshots.

Would you create and upload one, maybe in the private Launchpad Mattermost channel?

Maybe even from before and after?

Thank you!

review: Needs Information
Revision history for this message
Andrey Fedoseev (andrey-fedoseev) wrote :

I assumed that the included tests are enough to illustrate that it's working.

Here you go, anyway: https://people.canonical.com/~afedoseev/LP-962/

I couldn't find a reliable way to demo it except for the "View Page Source" mode in the browser.

Revision history for this message
Jürgen Gmach (jugmac00) wrote :

> I couldn't find a reliable way to demo it

This should be visible in the browser tab, right?

Anyway - looks good!

I have one further question - but that is not a blocker, this just something for me to understand the view/template system better.

review: Approve
Revision history for this message
Andrey Fedoseev (andrey-fedoseev) wrote :

> This should be visible in the browser tab, right?

The title in the browser tab is trimmed, so the title part that's been added by this change is mostly hidden.

Revision history for this message
Andrey Fedoseev (andrey-fedoseev) :
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

> The title in the browser tab is trimmed, so the title part that's been added by this change is mostly hidden.

You can hover the mouse over it, then you'll see a popup - which indeed gets caught by a screenshot.

Revision history for this message
Jürgen Gmach (jugmac00) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/answers/browser/question.py b/lib/lp/answers/browser/question.py
2index 7e5926a..65bbd94 100644
3--- a/lib/lp/answers/browser/question.py
4+++ b/lib/lp/answers/browser/question.py
5@@ -296,6 +296,13 @@ class QuestionBreadcrumb(Breadcrumb):
6 def text(self):
7 return "Question #%d" % self.context.id
8
9+ @property
10+ def detail(self):
11+ return smartquote('%s "%s"') % (
12+ self.text,
13+ self.context.title,
14+ )
15+
16
17 class QuestionSetView(LaunchpadFormView):
18 """View for the Answer Tracker index page."""
19diff --git a/lib/lp/answers/browser/tests/test_views.py b/lib/lp/answers/browser/tests/test_views.py
20index 9dd7757..c329907 100644
21--- a/lib/lp/answers/browser/tests/test_views.py
22+++ b/lib/lp/answers/browser/tests/test_views.py
23@@ -33,7 +33,7 @@ class TestEmailObfuscated(BrowserTestCase):
24 browser = self.getBrowserForQuestionWithEmail(
25 email_address, no_login=False
26 )
27- self.assertEqual(4, browser.contents.count(email_address))
28+ self.assertEqual(6, browser.contents.count(email_address))
29
30 def test_anonymous_sees_not_email_address(self):
31 """The anonymous user cannot see the email address on the page."""
32diff --git a/lib/lp/answers/stories/question-browse-and-search.rst b/lib/lp/answers/stories/question-browse-and-search.rst
33index 90b15a7..61cc8cf 100644
34--- a/lib/lp/answers/stories/question-browse-and-search.rst
35+++ b/lib/lp/answers/stories/question-browse-and-search.rst
36@@ -139,7 +139,7 @@ details of the question are available.
37
38 >>> browser.getLink("Slow system").click()
39 >>> print(browser.title)
40- Question #7 : ...
41+ Question #7 “Slow system” : ...
42 >>> soup = find_main_content(browser.contents)
43 >>> soup("div", "report")
44 [<div class="report"><p>I get really poor hard drive
45@@ -161,9 +161,8 @@ to jump to the question.
46 >>> browser.open("http://answers.launchpad.test/")
47 >>> browser.getControl(name="field.search_text").value = "9"
48 >>> browser.getControl("Find Answers").click()
49- >>> from lp.services.helpers import backslashreplace
50- >>> print(backslashreplace(browser.title))
51- Question #9 : ...
52+ >>> print(browser.title)
53+ Question #9 ...
54
55 While reading the Ubuntu forums for a solution to his problem,
56 Average Joe finds some unlinked text that refers to how to
57@@ -174,8 +173,8 @@ the answer.
58 >>> browser.open("http://answers.launchpad.test/")
59 >>> browser.getControl(name="field.search_text").value = " #6 "
60 >>> browser.getControl("Find Answers").click()
61- >>> print(backslashreplace(browser.title))
62- Question #6 : ...
63+ >>> print(browser.title)
64+ Question #6 ...
65
66 The Answer Tracker cannot identify Question ids within text. Average
67 Joe finds a reference to question 8 in a blog. He copies 'question 8'
68@@ -243,7 +242,7 @@ He clicks on the link to read the question description.
69
70 >>> browser.getLink("Firefox is slow").click()
71 >>> print(browser.title)
72- Question #3 : ...
73+ Question #3 “Firefox is slow and consumes too much RAM” : ...
74
75 The user must choose at least one status when searching questions. An
76 error is displayed when the user forgets to select a status.
77diff --git a/lib/lp/answers/stories/question-message.rst b/lib/lp/answers/stories/question-message.rst
78index c6ca281..f733968 100644
79--- a/lib/lp/answers/stories/question-message.rst
80+++ b/lib/lp/answers/stories/question-message.rst
81@@ -12,9 +12,6 @@ an email post to examine the markup rules. This message contains a
82 quoted passage, and a signature with an email address in it.
83
84 >>> user_browser.open("http://answers.launchpad.test/ubuntu/+question/11")
85- >>> print(user_browser.title)
86- Question #11 : ...
87-
88 >>> user_browser.getControl("Message").value = (
89 ... "Top quoting is bad netiquette.\n"
90 ... "The leading text will be displayed\n"
91@@ -39,8 +36,6 @@ Email addresses are only shown to authenticated users
92 Email addresses are visible to authenticated users. Sample Person is
93 authenticated already, so they will see 'human@somewhere.org'.
94
95- >>> print(user_browser.title)
96- Question #11 : ...
97 >>> text = find_tags_by_class(user_browser.contents, "boardCommentBody")[
98 ... -1
99 ... ]
100@@ -55,9 +50,6 @@ of 'person@domain.dom'. The anonymous user is unauthenticated, so they will
101 see the obfuscated email address (<email address hidden>).
102
103 >>> anon_browser.open("http://answers.launchpad.test/ubuntu/+question/11")
104- >>> print(anon_browser.title)
105- Question #11 : ...
106-
107 >>> text = find_tags_by_class(anon_browser.contents, "boardCommentBody")[
108 ... -1
109 ... ]
110diff --git a/lib/lp/answers/stories/question-overview.rst b/lib/lp/answers/stories/question-overview.rst
111index 612ee94..9f1d807 100644
112--- a/lib/lp/answers/stories/question-overview.rst
113+++ b/lib/lp/answers/stories/question-overview.rst
114@@ -59,7 +59,7 @@ question page.
115
116 >>> browser.getLink("Problem showing the SVG demo on W3C site").click()
117 >>> print(browser.title)
118- Question #2 : ...
119+ Question #2 “Problem showing the SVG demo on W3C site” : ...
120
121 >>> print(
122 ... find_main_content(browser.contents).find("h1").decode_contents()
123diff --git a/lib/lp/answers/stories/this-is-a-faq.rst b/lib/lp/answers/stories/this-is-a-faq.rst
124index 948c5fa..1ccb2ba 100644
125--- a/lib/lp/answers/stories/this-is-a-faq.rst
126+++ b/lib/lp/answers/stories/this-is-a-faq.rst
127@@ -35,14 +35,12 @@ For example, No Privileges Person comes across a question about SVG
128 support in Firefox. That question has a well-known answer, so they click
129 on 'Link to a FAQ' to answer the question:
130
131- # We use backslashreplace because the page title includes smart quotes.
132- >>> from lp.services.helpers import backslashreplace
133 >>> user_browser.open("http://answers.launchpad.test/firefox/+question/2")
134- >>> print(backslashreplace(user_browser.title))
135- Question #2 : ...
136+ >>> print(user_browser.title)
137+ Question #2 ...
138
139 >>> user_browser.getLink("Link to a FAQ").click()
140- >>> print(backslashreplace(user_browser.title))
141+ >>> print(user_browser.title)
142 Is question #2 a FAQ...
143
144 This page lists the existing FAQs matching the question's title. In
145@@ -143,6 +141,7 @@ A link to the FAQ appears under the question's description:
146
147 The answer message was added to the question's discussion:
148
149+ >>> from lp.services.helpers import backslashreplace
150 >>> print(
151 ... backslashreplace(
152 ... extract_text(
153@@ -389,7 +388,7 @@ can also be linked to FAQs.
154
155 >>> user_browser.open("http://answers.launchpad.test/ubuntu/+question/11")
156 >>> print(user_browser.title)
157- Question #11 : ...
158+ Question #11 ...
159 >>> user_browser.getLink("Link to a FAQ").click()
160 >>> print(user_browser.title)
161 Is question #11 a FAQ...
162@@ -399,7 +398,7 @@ can also be linked to FAQs.
163 ... "/+question/8"
164 ... )
165 >>> print(user_browser.title)
166- Question #8 : ...
167+ Question #8 ...
168 >>> user_browser.getLink("Link to a FAQ").click()
169 >>> user_browser.title
170 'Is question #8 a FAQ...
171@@ -439,7 +438,7 @@ added to the question, and their message was added to the question's
172 discussion.
173
174 >>> print(user_browser.title)
175- Question #9 : ...
176+ Question #9 ...
177 >>> print_question_status(user_browser)
178 Status: Solved
179

Subscribers

People subscribed via source and target branches

to status/vote changes: