Merge branch '54146-fix-calendar-query' into 'master'

Fix calendar feed when sorted by priority

Closes #54146

See merge request gitlab-org/gitlab-ce!23870
This commit is contained in:
Grzegorz Bizon 2018-12-19 10:03:44 +00:00
commit ffef28ccd6
3 changed files with 15 additions and 1 deletions

View File

@ -3,7 +3,7 @@ cal.prodid = '-//GitLab//NONSGML GitLab//EN'
cal.x_wr_calname = 'GitLab Issues'
# rubocop: disable CodeReuse/ActiveRecord
@issues.includes(project: :namespace).each do |issue|
@issues.preload(project: :namespace).each do |issue|
cal.event do |event|
event.dtstart = Icalendar::Values::Date.new(issue.due_date)
event.summary = "#{issue.title} (in #{issue.project.full_path})"

View File

@ -0,0 +1,5 @@
---
title: Fix project calendar feed when sorted by priority
merge_request: 23870
author:
type: fixed

View File

@ -72,5 +72,14 @@ describe 'Project Issues Calendar Feed' do
expect(body).to have_text('TRANSP:TRANSPARENT')
end
end
context 'sorted by priority' do
it 'renders calendar feed' do
visit project_issues_path(project, :ics, sort: 'priority', feed_token: user.feed_token)
expect(response_headers['Content-Type']).to have_content('text/calendar')
expect(body).to have_text('BEGIN:VCALENDAR')
end
end
end
end