Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Remove content_type from ics invite

Oliver Güntheref059505df11
diff --git a/modules/meeting/app/mailers/meeting_mailer.rb b/modules/meeting/app/mailers/meeting_mailer.rb
index dc649ccf9f0..e6b6abb11a1 100644
--- a/modules/meeting/app/mailers/meeting_mailer.rb
+++ b/modules/meeting/app/mailers/meeting_mailer.rb
@@ -57,9 +57,8 @@ class MeetingMailer < UserMailer
end
end
- def icalendar_notification(meeting, content_type, user)
+ def icalendar_notification(meeting, user, _actor, **)
@meeting = meeting
- @content_type = content_type
set_headers @meeting
diff --git a/modules/meeting/app/services/meeting_notification_service.rb b/modules/meeting/app/services/meeting_notification_service.rb
index 80cc0c76dd3..ec08d5fb568 100644
--- a/modules/meeting/app/services/meeting_notification_service.rb
+++ b/modules/meeting/app/services/meeting_notification_service.rb
@@ -12,14 +12,14 @@ class MeetingNotificationService
private
- def send_notifications!(action, include_author:, **params)
+ def send_notifications!(action, include_author:, **)
author_mail = meeting.author.mail
recipients_with_errors = []
meeting.participants.includes(:user).find_each do |recipient|
next if recipient.mail == author_mail && !include_author
- MeetingMailer.send(action, meeting, recipient.user, User.current, **params).deliver_later
+ MeetingMailer.send(action, meeting, recipient.user, User.current, **).deliver_later
rescue StandardError => e
Rails.logger.error do
"Failed to deliver #{action} notification to #{recipient.mail}: #{e.message}"
diff --git a/modules/meeting/spec/controllers/meeting_contents_controller_spec.rb b/modules/meeting/spec/controllers/meeting_contents_controller_spec.rb
index d2a656e42a6..18d4d4b4c4b 100644
--- a/modules/meeting/spec/controllers/meeting_contents_controller_spec.rb
+++ b/modules/meeting/spec/controllers/meeting_contents_controller_spec.rb
@@ -36,7 +36,12 @@ RSpec.describe MeetingContentsController do
shared_let(:watcher2) { create(:user, member_with_roles: { project => role }) }
shared_let(:meeting) do
User.execute_as author do
- create(:meeting, author:, project:)
+ meeting = build(:meeting, author:, project:)
+ meeting.participants.build(user: watcher1, invited: true, attended: false)
+ meeting.participants.build(user: watcher2, invited: true, attended: false)
+
+ meeting.save!
+ meeting
end
end
shared_let(:meeting_agenda) do
@@ -49,9 +54,6 @@ RSpec.describe MeetingContentsController do
ActionMailer::Base.deliveries = []
allow_any_instance_of(MeetingContentsController).to receive(:find_content)
allow(controller).to receive(:authorize)
- meeting.participants.merge([meeting.participants.build(user: watcher1, invited: true, attended: false),
- meeting.participants.build(user: watcher2, invited: true, attended: false)])
- meeting.save!
controller.instance_variable_set(:@content, meeting_agenda.meeting.agenda)
controller.instance_variable_set(:@content_type, 'meeting_agenda')
end
@@ -59,7 +61,11 @@ RSpec.describe MeetingContentsController do
shared_examples_for 'delivered by mail' do
before { put action, params: { meeting_id: meeting.id } }
- it { expect(ActionMailer::Base.deliveries.count).to eql(mail_count) }
+ it 'submits the mails' do
+ perform_enqueued_jobs
+
+ expect(ActionMailer::Base.deliveries.count).to eql(mail_count)
+ end
end
describe 'PUT' do
@@ -76,7 +82,7 @@ RSpec.describe MeetingContentsController do
context 'with an error during deliver' do
before do
- allow(MeetingMailer).to receive(:content_for_review).and_raise(Net::SMTPError)
+ allow(MeetingMailer).to receive(:invited).and_raise(Net::SMTPError)
end
it 'does not raise an error' do
@@ -84,7 +90,7 @@ RSpec.describe MeetingContentsController do
end
it 'produces a flash message containing the mail addresses raising the error' do
- put 'notify', params: { meeting_id: meeting.id }
+ put 'notify', params: { meeting_id: meeting.id }
meeting.participants.each do |participant|
expect(flash[:error]).to include(participant.name)
end
@@ -106,7 +112,7 @@ RSpec.describe MeetingContentsController do
context 'with an error during deliver' do
before do
author.save!
- allow(MeetingMailer).to receive(:content_for_review).and_raise(Net::SMTPError)
+ allow(MeetingMailer).to receive(:invited).and_raise(Net::SMTPError)
end
it 'does not raise an error' do