Merge lp:~mhr3/unity-lens-shopping/hide-errors into lp:unity-lens-shopping

Proposed by Michal Hruby
Status: Merged
Approved by: Michal Hruby
Approved revision: 30
Merged at revision: 28
Proposed branch: lp:~mhr3/unity-lens-shopping/hide-errors
Merge into: lp:unity-lens-shopping
Diff against target: 80 lines (+26/-5)
2 files modified
src/scope.vala (+12/-5)
tests/manual-tests/shopping-lens-tests.txt (+14/-0)
To merge this branch: bzr merge lp:~mhr3/unity-lens-shopping/hide-errors
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
Review via email: mp+127554@code.launchpad.net

Commit message

Show empty preview on network issues, chug input strings instead of stripping them

Description of the change

Currently if it's not possible to get preview for a result (due to for example network issue). A preview is displayed with description that shows the error message from libsoup, although handy for development, this isn't desired to be shown to the user. (also includes a tiny closure data leak fix)

To post a comment you must log in.
Revision history for this message
Paweł Stołowski (stolowski) wrote :

Could you please add a manual test for error case?

review: Needs Fixing
Revision history for this message
Michal Hruby (mhr3) wrote :

> Could you please add a manual test for error case?

Done

Revision history for this message
Paweł Stołowski (stolowski) wrote :

Thanks. Works Fine.

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity-lens-shopping/7/console reported an error when processing this lp:~mhr3/unity-lens-shopping/hide-errors branch.
Not merging it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/scope.vala'
2--- src/scope.vala 2012-09-28 14:25:32 +0000
3+++ src/scope.vala 2012-10-03 12:15:41 +0000
4@@ -56,7 +56,7 @@
5
6 /* No need to search if only the whitespace changes */
7 generate_search_key.connect ((lens_search) => {
8- return lens_search.search_string.strip ();
9+ return lens_search.search_string.chug ();
10 });
11
12 /* Listen for changes to the lens search entry */
13@@ -107,7 +107,7 @@
14 Cancellable cancellable)
15 {
16 search.results_model.clear ();
17- string query_string = search.search_string.strip ();
18+ string query_string = search.search_string.chug ();
19 if (query_string == "") return;
20
21 var uri = build_search_uri (query_string, SearchType.GLOBAL);
22@@ -128,7 +128,7 @@
23 Cancellable cancellable)
24 {
25 search.results_model.clear ();
26- string query_string = search.search_string.strip ();
27+ string query_string = search.search_string.chug ();
28 if (query_string == "") return;
29
30 // we want prefix matching too
31@@ -155,8 +155,9 @@
32 }
33 catch (Error err)
34 {
35- return new GenericPreview (Path.get_basename (details_uri),
36- err.message, null);
37+ warning ("%s", err.message);
38+ // FIXME: just return null when libunity handles that gracefully
39+ return new GenericPreview ("", "", null);
40 }
41
42 if (U1MSPreviewFactory.is_u1ms_details (parser))
43@@ -275,6 +276,12 @@
44 throw new IOError.CANCELLED ("Cancelled");
45 }
46
47+ if (cancellable != null)
48+ {
49+ // clean up
50+ cancellable.disconnect (cancel_id);
51+ }
52+
53 if (msg.status_code < 100)
54 {
55 throw new IOError.FAILED ("Request failed with error %u", msg.status_code);
56
57=== modified file 'tests/manual-tests/shopping-lens-tests.txt'
58--- tests/manual-tests/shopping-lens-tests.txt 2012-09-28 14:25:32 +0000
59+++ tests/manual-tests/shopping-lens-tests.txt 2012-10-03 12:15:41 +0000
60@@ -70,6 +70,20 @@
61 Expected Results:
62 Web site for selected item is opened in web browser, with an option to complete purchase.
63
64+Previewing item after losing network connectivity
65+-------------------------------------------------
66+Previewing and item after losing network should display an empty preview.
67+
68+Setup:
69+Internet connectivity.
70+
71+Actions:
72+Perform a search that returns results in the dash home "More suggestions" category.
73+Disconnect from the internet, afterwards try previewing any of the results.
74+
75+Expected Results:
76+An empty preview should be displayed. Note that performing searches without internet connectivity will not return any results in the "More suggestions" category.
77+
78 'Disable' Shopping Lens Search
79 ----------------------------------------------------
80 Disabling the shopping lens should not show any result.

Subscribers

People subscribed via source and target branches

to all changes: