diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-10-22 14:13:35 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-10-22 14:13:35 +0000 |
commit | d310a2d0bc2d51724276e46143f51b11fe03e961 (patch) | |
tree | 4aee08ee96b17c56987936c81c1a5ba332e77165 | |
parent | d90716aff22310b27734df86d287d2cb4084fdbb (diff) | |
parent | 69eba88532a349111e38f5c17038de3f2953dd5b (diff) | |
download | gitlab-ce-d310a2d0bc2d51724276e46143f51b11fe03e961.tar.gz |
Merge branch 'bvl-fix-group-atom-feed' into 'master'
Make sure we render events for projects within a group
Closes #39305
See merge request gitlab-org/gitlab-ce!14974
-rw-r--r-- | app/controllers/groups_controller.rb | 11 | ||||
-rw-r--r-- | changelogs/unreleased/bvl-fix-group-atom-feed.yml | 5 | ||||
-rw-r--r-- | spec/controllers/groups_controller_spec.rb | 25 |
3 files changed, 41 insertions, 0 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index e23a82d01be..bc3e95f1aed 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -141,6 +141,17 @@ class GroupsController < Groups::ApplicationController end def load_events + params[:sort] ||= 'latest_activity_desc' + + options = {} + options[:only_owned] = true if params[:shared] == '0' + options[:only_shared] = true if params[:shared] == '1' + + @projects = GroupProjectsFinder.new(params: params, group: group, options: options, current_user: current_user) + .execute + .includes(:namespace) + .page(params[:page]) + @events = EventCollection .new(@projects, offset: params[:offset].to_i, filter: event_filter) .to_a diff --git a/changelogs/unreleased/bvl-fix-group-atom-feed.yml b/changelogs/unreleased/bvl-fix-group-atom-feed.yml new file mode 100644 index 00000000000..48f67db7799 --- /dev/null +++ b/changelogs/unreleased/bvl-fix-group-atom-feed.yml @@ -0,0 +1,5 @@ +--- +title: Fix the atom feed for group events +merge_request: 14974 +author: +type: fixed diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index e7631d4d709..5036c1d2226 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -32,6 +32,31 @@ describe GroupsController do end end + describe 'GET #show' do + before do + sign_in(user) + project + end + + context 'as html' do + it 'assigns whether or not a group has children' do + get :show, id: group.to_param + + expect(assigns(:has_children)).to be_truthy + end + end + + context 'as atom' do + it 'assigns events for all the projects in the group' do + create(:event, project: project) + + get :show, id: group.to_param, format: :atom + + expect(assigns(:events)).not_to be_empty + end + end + end + describe 'GET #new' do context 'when creating subgroups', :nested_groups do [true, false].each do |can_create_group_status| |