Commit 763b34f7 authored by Imre Farkas's avatar Imre Farkas

Merge branch 'fix-project-controller-event-feed' into 'master'

Fix missing RSS feed events

Closes #29990 and #24227

See merge request gitlab-org/gitlab!19524
parents 6595d2f9 2500424f
......@@ -33,7 +33,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def starred
@projects = load_projects(params.merge(starred: true))
.includes(:forked_from_project, :tags)
.includes(:forked_from_project, :tags).page(params[:page])
@groups = []
......@@ -51,7 +51,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
private
def projects
@projects ||= load_projects(params.merge(non_public: true))
@projects ||= load_projects(params.merge(non_public: true)).page(params[:page])
end
def render_projects
......@@ -73,7 +73,6 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
.execute
.includes(:route, :creator, :group, namespace: [:route, :owner])
.preload(:project_feature)
.page(finder_params[:page])
prepare_projects_for_rendering(projects)
end
......
---
title: Fix missing RSS feed events
merge_request: 19524
author:
type: fixed
......@@ -86,11 +86,58 @@ describe Dashboard::ProjectsController do
end
describe 'GET /starred.json' do
subject { get :starred, format: :json }
let(:projects) { create_list(:project, 2, creator: user) }
before do
get :starred, format: :json
allow(Kaminari.config).to receive(:default_per_page).and_return(1)
projects.each do |project|
project.add_developer(user)
create(:users_star_project, project_id: project.id, user_id: user.id)
end
end
it { is_expected.to respond_with(:success) }
it 'returns success' do
subject
expect(response).to have_gitlab_http_status(:ok)
end
it 'paginates the records' do
subject
expect(assigns(:projects).count).to eq(1)
end
end
end
context 'atom requests' do
let(:user) { create(:user) }
before do
sign_in(user)
end
describe '#index' do
context 'project pagination' do
let(:projects) { create_list(:project, 2, creator: user) }
before do
allow(Kaminari.config).to receive(:default_per_page).and_return(1)
projects.each do |project|
project.add_developer(user)
end
end
it 'does not paginate projects, even if page number is passed' do
get :index, format: :atom
expect(assigns(:events).count).to eq(2)
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment