Fix calendar feed when sorted by priority

This commit is contained in:
Heinrich Lee Yu 2018-12-17 18:27:10 +08:00
parent 8b4602041c
commit 685c0f237d
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