1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

Fix a bug: rss/projects was failing with project without image

This commit is contained in:
Nicolas Florentin 2023-09-28 08:49:36 +02:00
parent 7cbf75c37f
commit b11bb11968
5 changed files with 33 additions and 2 deletions

View File

@ -5,6 +5,7 @@
- Fix a bug: unable to sync projects with openprojects
- Fix a bug: public availabilities (no user) was buggy (server error)
- Fix a bug: unable to generate statistic
- Fix a bug: rss/projects was failing with project without image
- [TODO DEPLOY] `rails fablab:openlab:bulk_export`
- [TODO DEPLOY] `rails fablab:openlab:bulk_update`

View File

@ -22,7 +22,9 @@ xml.rss version: '2.0', 'xmlns:xCal' => 'urn:ietf:params:xml:ns:xcal' do
xml.xCal :dtend do
xml.text! event.availability.end_at.strftime('%FT%T%:z')
end
xml.enclosure url: root_url + event.event_image.attachment.large.url, length: event.event_image.attachment.large.size, type: event.event_image.attachment.content_type if event.event_image
if event.event_image&.attachment?
xml.enclosure url: root_url + event.event_image.attachment.large.url, length: event.event_image.attachment.large.size, type: event.event_image.attachment.content_type
end
xml.category event.category.name
end
end

View File

@ -17,7 +17,9 @@ xml.rss version: '2.0' do
xml.link root_url + '#!/projects/' + project.slug
xml.author project.author&.user&.profile&.full_name
xml.description project.description
xml.enclosure url: root_url + project.project_image.attachment.large.url, length: project.project_image.attachment.large.size, type: project.project_image.attachment.content_type if project.project_image
if project.project_image&.attachment?
xml.enclosure url: root_url + project.project_image.attachment.large.url, length: project.project_image.attachment.large.size, type: project.project_image.attachment.content_type
end
end
end
end

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'test_helper'
module Rss; end
class Rss::EventsTestTest < ActionDispatch::IntegrationTest
test '#index' do
get rss_events_path
assert_response :success
assert Nokogiri::XML(response.body).errors.empty?
end
end

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'test_helper'
module Rss; end
class Rss::ProjectsTestTest < ActionDispatch::IntegrationTest
test '#index' do
get rss_projects_path
assert_response :success
assert Nokogiri::XML(response.body).errors.empty?
end
end