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
=== modified file 'src/scope.vala'
--- src/scope.vala 2012-09-28 14:25:32 +0000
+++ src/scope.vala 2012-10-03 12:15:41 +0000
@@ -56,7 +56,7 @@
5656
57 /* No need to search if only the whitespace changes */57 /* No need to search if only the whitespace changes */
58 generate_search_key.connect ((lens_search) => {58 generate_search_key.connect ((lens_search) => {
59 return lens_search.search_string.strip ();59 return lens_search.search_string.chug ();
60 });60 });
6161
62 /* Listen for changes to the lens search entry */62 /* Listen for changes to the lens search entry */
@@ -107,7 +107,7 @@
107 Cancellable cancellable)107 Cancellable cancellable)
108 {108 {
109 search.results_model.clear ();109 search.results_model.clear ();
110 string query_string = search.search_string.strip ();110 string query_string = search.search_string.chug ();
111 if (query_string == "") return;111 if (query_string == "") return;
112112
113 var uri = build_search_uri (query_string, SearchType.GLOBAL);113 var uri = build_search_uri (query_string, SearchType.GLOBAL);
@@ -128,7 +128,7 @@
128 Cancellable cancellable)128 Cancellable cancellable)
129 {129 {
130 search.results_model.clear ();130 search.results_model.clear ();
131 string query_string = search.search_string.strip ();131 string query_string = search.search_string.chug ();
132 if (query_string == "") return;132 if (query_string == "") return;
133133
134 // we want prefix matching too134 // we want prefix matching too
@@ -155,8 +155,9 @@
155 }155 }
156 catch (Error err)156 catch (Error err)
157 {157 {
158 return new GenericPreview (Path.get_basename (details_uri),158 warning ("%s", err.message);
159 err.message, null);159 // FIXME: just return null when libunity handles that gracefully
160 return new GenericPreview ("", "", null);
160 }161 }
161162
162 if (U1MSPreviewFactory.is_u1ms_details (parser))163 if (U1MSPreviewFactory.is_u1ms_details (parser))
@@ -275,6 +276,12 @@
275 throw new IOError.CANCELLED ("Cancelled");276 throw new IOError.CANCELLED ("Cancelled");
276 }277 }
277278
279 if (cancellable != null)
280 {
281 // clean up
282 cancellable.disconnect (cancel_id);
283 }
284
278 if (msg.status_code < 100)285 if (msg.status_code < 100)
279 {286 {
280 throw new IOError.FAILED ("Request failed with error %u", msg.status_code);287 throw new IOError.FAILED ("Request failed with error %u", msg.status_code);
281288
=== modified file 'tests/manual-tests/shopping-lens-tests.txt'
--- tests/manual-tests/shopping-lens-tests.txt 2012-09-28 14:25:32 +0000
+++ tests/manual-tests/shopping-lens-tests.txt 2012-10-03 12:15:41 +0000
@@ -70,6 +70,20 @@
70Expected Results:70Expected Results:
71Web site for selected item is opened in web browser, with an option to complete purchase.71Web site for selected item is opened in web browser, with an option to complete purchase.
7272
73Previewing item after losing network connectivity
74-------------------------------------------------
75Previewing and item after losing network should display an empty preview.
76
77Setup:
78Internet connectivity.
79
80Actions:
81Perform a search that returns results in the dash home "More suggestions" category.
82Disconnect from the internet, afterwards try previewing any of the results.
83
84Expected Results:
85An empty preview should be displayed. Note that performing searches without internet connectivity will not return any results in the "More suggestions" category.
86
73'Disable' Shopping Lens Search87'Disable' Shopping Lens Search
74----------------------------------------------------88----------------------------------------------------
75Disabling the shopping lens should not show any result.89Disabling the shopping lens should not show any result.

Subscribers

People subscribed via source and target branches

to all changes: