Merge lp:~marcustomlinson/unity-scope-vimeo/respond_to_aggregators into lp:unity-scope-vimeo

Proposed by Marcus Tomlinson
Status: Merged
Approved by: James Henstridge
Approved revision: 74
Merged at revision: 74
Proposed branch: lp:~marcustomlinson/unity-scope-vimeo/respond_to_aggregators
Merge into: lp:unity-scope-vimeo
Diff against target: 48 lines (+17/-6)
1 file modified
src/vimeo/scope/query.cpp (+17/-6)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scope-vimeo/respond_to_aggregators
Reviewer Review Type Date Requested Status
James Henstridge Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+241772@code.launchpad.net

Commit message

Update Query::run() to react accordingly when being aggregated.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
James Henstridge (jamesh) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/vimeo/scope/query.cpp'
2--- src/vimeo/scope/query.cpp 2014-11-10 11:50:21 +0000
3+++ src/vimeo/scope/query.cpp 2014-11-14 09:23:05 +0000
4@@ -16,6 +16,7 @@
5 * Author: Pete Woods <pete.woods@canonical.com>
6 */
7
8+#include <boost/algorithm/string/predicate.hpp>
9 #include <boost/algorithm/string/trim.hpp>
10
11 #include <vimeo/scope/localisation.h>
12@@ -122,20 +123,30 @@
13 channel->id(), query, channel->name());
14 all_depts->add_subdepartment(dept);
15 }
16- reply->register_departments(all_depts);
17
18 bool include_login_nag = !client_.config()->authenticated;
19- if (include_login_nag) {
20- add_login_nag(reply);
21- }
22-
23- if (!query.department_id().empty()) {
24+
25+ if (alg::starts_with(query.department_id(), "aggregated:")) {
26+ // Need to add a dummy department to pass the validation check
27+ sc::Department::SPtr dummy = sc::Department::create(
28+ query.department_id(), query, " ");
29+ all_depts->add_subdepartment(dummy);
30+
31+ include_login_nag = false;
32+ videos = client_.channels_videos("staffpicks");
33+ } else if (!query.department_id().empty()) {
34 videos = client_.channels_videos(query.department_id());
35 } else if (client_.config()->authenticated) {
36 videos = client_.feed();
37 } else {
38 videos = client_.channels_videos("staffpicks");
39 }
40+
41+ reply->register_departments(all_depts);
42+
43+ if (include_login_nag) {
44+ add_login_nag(reply);
45+ }
46 } else {
47 videos = client_.videos(query_string);
48 }

Subscribers

People subscribed via source and target branches