Merge lp:~stolowski/unity-scopes-shell/reset-user-data into lp:unity-scopes-shell

Proposed by Paweł Stołowski
Status: Merged
Approved by: Marcus Tomlinson
Approved revision: 210
Merged at revision: 210
Proposed branch: lp:~stolowski/unity-scopes-shell/reset-user-data
Merge into: lp:unity-scopes-shell
Prerequisite: lp:~stolowski/unity-scopes-shell/fix-1335761
Diff against target: 41 lines (+12/-1)
2 files modified
src/Unity/scope.cpp (+11/-1)
src/Unity/scope.h (+1/-0)
To merge this branch: bzr merge lp:~stolowski/unity-scopes-shell/reset-user-data
Reviewer Review Type Date Requested Status
Marcus Tomlinson (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+257739@code.launchpad.net

This proposal supersedes a proposal from 2015-04-29.

Commit message

Reset user data set with previously executed canned query when shell calls setSearchQuery() (i.e.user typed a new search).

Description of the change

Reset user data set with previously executed canned query when shell calls setSearchQuery() (i.e.user typed a new search). Keeping the previous value and sending it again with new search (which is a user input, so no side-channel data should exists) is a bug that can confuse scopes.

To post a comment you must log in.
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote : Posted in a previous version of this proposal

Indeed

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

Re-approving

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Unity/scope.cpp'
--- src/Unity/scope.cpp 2015-04-29 11:43:20 +0000
+++ src/Unity/scope.cpp 2015-04-29 11:43:20 +0000
@@ -267,7 +267,7 @@
267 {267 {
268 m_queryUserData.reset(nullptr);268 m_queryUserData.reset(nullptr);
269 }269 }
270 setSearchQuery(QString::fromStdString(query.query_string()));270 setSearchQueryString(QString::fromStdString(query.query_string()));
271}271}
272272
273void Scope::executeCannedQuery(unity::scopes::CannedQuery const& query, bool allowDelayedActivation)273void Scope::executeCannedQuery(unity::scopes::CannedQuery const& query, bool allowDelayedActivation)
@@ -1033,6 +1033,16 @@
10331033
1034void Scope::setSearchQuery(const QString& search_query)1034void Scope::setSearchQuery(const QString& search_query)
1035{1035{
1036 // this method is called by the shell when user types in search string,
1037 // it needs to reset canned query user data.
1038 if (m_searchQuery.isNull() || search_query != m_searchQuery) {
1039 m_queryUserData.reset(nullptr);
1040 }
1041 setSearchQueryString(search_query);
1042}
1043
1044void Scope::setSearchQueryString(const QString& search_query)
1045{
1036 /* Checking for m_searchQuery.isNull() which returns true only when the string1046 /* Checking for m_searchQuery.isNull() which returns true only when the string
1037 has never been set is necessary because when search_query is the empty1047 has never been set is necessary because when search_query is the empty
1038 string ("") and m_searchQuery is the null string,1048 string ("") and m_searchQuery is the null string,
10391049
=== modified file 'src/Unity/scope.h'
--- src/Unity/scope.h 2015-03-20 14:44:32 +0000
+++ src/Unity/scope.h 2015-04-29 11:43:20 +0000
@@ -171,6 +171,7 @@
171 Scope::Ptr findTempScope(QString const& id) const;171 Scope::Ptr findTempScope(QString const& id) const;
172172
173 bool loginToAccount(QString const& scope_id, QString const& service_name, QString const& service_type, QString const& provider_name);173 bool loginToAccount(QString const& scope_id, QString const& service_name, QString const& service_type, QString const& provider_name);
174 void setSearchQueryString(const QString& search_query);
174175
175public Q_SLOTS:176public Q_SLOTS:
176 void invalidateResults();177 void invalidateResults();

Subscribers

People subscribed via source and target branches

to all changes: