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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add invited preview
Oliver Güntherce105d3b3004
diff --git a/modules/meeting/app/mailers/meeting_mailer.rb b/modules/meeting/app/mailers/meeting_mailer.rbindex de6c39387a5..716c97083c6 100644--- a/modules/meeting/app/mailers/meeting_mailer.rb+++ b/modules/meeting/app/mailers/meeting_mailer.rb@@ -27,8 +27,8 @@#++class MeetingMailer < UserMailer- def invited(meeting, user, author)- @author = author+ def invited(meeting, user, actor)+ @actor = actor@meeting = meetingopen_project_headers 'Project' => @meeting.project.identifier,diff --git a/modules/meeting/app/views/meeting_mailer/invited.html.erb b/modules/meeting/app/views/meeting_mailer/invited.html.erbindex 77a09aee8b5..bcfa91daeaf 100644--- a/modules/meeting/app/views/meeting_mailer/invited.html.erb+++ b/modules/meeting/app/views/meeting_mailer/invited.html.erb@@ -27,18 +27,88 @@ See COPYRIGHT and LICENSE files for more details.++#%>-<h1><%= link_to(@meeting.project.name, project_url(@meeting.project)) %>: <%= link_to(@meeting.title, meeting_url(@meeting)) %></h1>-<em><%= @meeting.author %></em>--<ul>-<li><%=t :label_meeting_date_time %>: <%= format_time_as_date @meeting.start_time %> <%= format_time @meeting.start_time, false %>-<%= format_time @meeting.end_time, false %> <%= Time.zone %></li>-<li><%=Meeting.human_attribute_name(:location) %>: <%= @meeting.location %></li>-<li><%=Meeting.human_attribute_name(:participants_invited) %>: <%= @meeting.participants.invited.sort.join("; ") %></li>-<li><%=Meeting.human_attribute_name(:participants_attended) %>: <%= @meeting.participants.attended.sort.join("; ") %></li>-</ul>--<p>- <%= raw t(:text_review_meeting,- :author => h(@author),- :link => link_to(@meeting.title, meeting_url(@meeting))) %>-</p>+<%= render layout: 'mailer/spacer_table' do %>+ <%= render partial: 'mailer/mailer_header',+ locals: {+ caption: I18n.t('meeting.email.invited.header', title: @meeting.title),+ subcaption: I18n.t('meeting.email.invited.summary', actor: @actor),+ bottom_spacing: false+ } %>++ <%= render layout: 'mailer/border_table' do %>+ <tr>+ <%= placeholder_cell('24px', vertical: true) %>+ <td>+ <table>+ <tr>+ <td style="<%= placeholder_text_styles(width: '30%') %>">+ <%= I18n.t(:label_meeting_date_time) %>+ </td>+ <td style="<%= placeholder_text_styles %>">+ <%= format_time_as_date @meeting.start_time %> <%= format_time @meeting.start_time, false %>+ -+ <%= format_time @meeting.end_time, false %> <%= Time.zone %>+ </td>+ </tr>+ <% if @meeting.location.present? %>+ <tr>+ <td style="<%= placeholder_text_styles(width: '30%') %>">+ <%= Meeting.human_attribute_name(:location) %>+ </td>+ <td style="<%= placeholder_text_styles %>">+ <%= auto_link @meeting.location %>+ </td>+ </tr>+ <% end %>+ <tr>+ <td style="<%= placeholder_text_styles(width: '30%') %>">+ <%= Meeting.human_attribute_name(:project) %>+ </td>+ <td style="<%= placeholder_text_styles %>">+ <%= link_to @meeting.project.name, project_url(@meeting.project) %>+ </td>+ </tr>+ <tr>+ <td style="<%= placeholder_text_styles(width: '30%') %>">+ <%= Meeting.human_attribute_name(:author) %>+ </td>+ <td style="<%= placeholder_text_styles %>">+ <%= @meeting.author %>+ </td>+ </tr>+ <% if @meeting.participants.any? %>+ <tr>+ <td style="<%= placeholder_text_styles(width: '30%') %>">+ <%= Meeting.human_attribute_name(:participants_invited) %>+ </td>+ <td style="<%= placeholder_text_styles %>">+ <%= @meeting.participants.invited.sort.join("; ") %>+ </td>+ </tr>+ <tr>+ <td style="<%= placeholder_text_styles(width: '30%') %>">+ <%= Meeting.human_attribute_name(:participants_attended) %>+ </td>+ <td style="<%= placeholder_text_styles %>">+ <%= @meeting.participants.attended.sort.join("; ") %>+ </td>+ </tr>+ <% end %>+ </table>+ </td>+ </tr>+ <% end %>++ <table>+ <tr>+ <%= placeholder_cell('20px', vertical: false) %>+ </tr>+ </table>++ <%= action_button do %>+ <%= link_to I18n.t(:'meeting.email.open_meeting_link'),+ meeting_url(@meeting),+ target: '_blank',+ style: "color: #333333; text-decoration: none; font-size: 14px;white-space: nowrap;" %>+ <% end %>+<% end %>diff --git a/modules/meeting/app/views/meeting_mailer/invited.text.erb b/modules/meeting/app/views/meeting_mailer/invited.text.erbindex 23435c17cf5..2a15f364390 100644--- a/modules/meeting/app/views/meeting_mailer/invited.text.erb+++ b/modules/meeting/app/views/meeting_mailer/invited.text.erb@@ -27,6 +27,8 @@ See COPYRIGHT and LICENSE files for more details.++#%>+<%= I18n.t('meeting.email.invited.summary', title: @meeting.title, actor: @actor) %>+<%= @meeting.project.name %>: <%= @meeting.title %> (<%= meeting_url(@meeting) %>)<%= @meeting.author %>@@ -34,7 +36,3 @@ See COPYRIGHT and LICENSE files for more details.<%= Meeting.human_attribute_name(:location) %>: <%= @meeting.location %><%= Meeting.human_attribute_name(:participants_invited) %>: <%= @meeting.participants.invited.sort.join("; ") %><%= Meeting.human_attribute_name(:participants_attended) %>: <%= @meeting.participants.attended.sort.join("; ") %>--<%= t(:text_review_meeting,- :author => @author,- :link => @meeting.title + " (#{meeting_url(@meeting)})") %>diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex 2cf2a08e40f..e8c4ae14dfb 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -112,6 +112,9 @@ en:meeting:email:open_meeting_link: "Open meeting"+ invited:+ header: "Invitation to Meeting %{title}"+ summary: "%{actor} has sent you an invitation to participate."rescheduled:header: "Meeting %{title} rescheduled by %{actor}"summary: "Meeting has been rescheduled by %{actor}"@@ -152,7 +155,6 @@ en:text_meeting_closing_are_you_sure: "Are you sure you want to close the meeting agenda?"text_meeting_agenda_open_are_you_sure: "This will overwrite all changes in the minutes! Do you want to continue?"text_meeting_minutes_for_meeting: 'minutes for the meeting "%{meeting}"'- text_review_meeting: "%{author} has sent you an invitation to the meeting %{link}."text_notificiation_invited: "This mail contains an ics entry for the meeting below:"text_meeting_empty_heading: "Your meeting is empty"diff --git a/modules/meeting/spec/mailers/meeting_mailer_spec.rb b/modules/meeting/spec/mailers/meeting_mailer_spec.rbindex 17444c4e7f8..da6ee794c6c 100644--- a/modules/meeting/spec/mailers/meeting_mailer_spec.rb+++ b/modules/meeting/spec/mailers/meeting_mailer_spec.rb@@ -56,8 +56,8 @@ RSpec.describe MeetingMailer domeeting.save!end- describe 'content_for_review' do- let(:mail) { described_class.content_for_review meeting_agenda, 'meeting_agenda', author }+ describe 'invited' do+ let(:mail) { described_class.invited(meeting, watcher1, author) }# this is needed to call module functions from Redmine::I18nlet(:i18n) doClass.new do@@ -69,7 +69,7 @@ RSpec.describe MeetingMailer doit 'renders the headers' doexpect(mail.subject).to include(meeting.project.name)expect(mail.subject).to include(meeting.title)- expect(mail.to).to contain_exactly(author.mail)+ expect(mail.to).to contain_exactly(watcher1.mail)expect(mail.from).to eq([Setting.mail_from])end@@ -83,7 +83,6 @@ RSpec.describe MeetingMailer docontext 'with a recipient with another time zone' dolet!(:preference) { create(:user_preference, user: watcher1, time_zone: 'Asia/Tokyo') }- let(:mail) { described_class.content_for_review meeting_agenda, 'meeting_agenda', watcher1 }it 'renders the mail with the correcet locale' doexpect(mail.text_part.body).to include('Tokyo')@@ -104,10 +103,11 @@ RSpec.describe MeetingMailer doenddescribe 'it renders november 9th for Berlin zone' do- let(:mail) { described_class.content_for_review meeting_agenda, 'meeting_agenda', author }+ let(:mail) { described_class.invited(meeting, author, author) }it 'renders the mail with the correct locale' do- expect(mail.html_part.body).to include('11/09/2021 11:00 PM-12:00 AM (GMT+01:00) Europe/Berlin')+ expect(mail.html_part.body).to include('11/09/2021 11:00 PM')+ expect(mail.html_part.body).to include('12:00 AM (GMT+01:00) Europe/Berlin')expect(mail.text_part.body).to include('11/09/2021 11:00 PM-12:00 AM (GMT+01:00) Europe/Berlin')expect(mail.to).to contain_exactly(author.mail)@@ -115,12 +115,14 @@ RSpec.describe MeetingMailer doenddescribe 'it renders november 10th for Tokyo zone' do- let(:mail) { described_class.content_for_review meeting_agenda, 'meeting_agenda', watcher1 }let!(:preference) { create(:user_preference, user: watcher1, time_zone: 'Asia/Tokyo') }+ let(:mail) { described_class.invited(meeting, watcher1, author) }it 'renders the mail with the correct locale' do+ expect(mail.html_part.body).to include('11/10/2021 07:00 AM')+ expect(mail.html_part.body).to include('08:00 AM (GMT+09:00) Asia/Tokyo')+expect(mail.text_part.body).to include('11/10/2021 07:00 AM-08:00 AM (GMT+09:00) Asia/Tokyo')- expect(mail.html_part.body).to include('11/10/2021 07:00 AM-08:00 AM (GMT+09:00) Asia/Tokyo')expect(mail.to).to contain_exactly(watcher1.mail)end@@ -138,7 +140,7 @@ RSpec.describe MeetingMailer dostart_time: "2021-01-19T10:00:00Z".to_time(:utc),duration: 1.0)end- let(:mail) { described_class.icalendar_notification meeting_agenda, 'meeting_agenda', author }+ let(:mail) { described_class.icalendar_notification(meeting, author, author) }it 'renders the headers' doexpect(mail.subject).to include(meeting.project.name)@@ -167,7 +169,8 @@ RSpec.describe MeetingMailer doexpect(body).to include(meeting.project.name)expect(body).to include(meeting.title)expect(body).to include(meeting.location)- expect(body).to include('01/19/2021 11:00 AM-12:00 PM (GMT+01:00) Europe/Berlin')+ expect(body).to include('01/19/2021 11:00 AM')+ expect(body).to include('12:00 PM (GMT+01:00) Europe/Berlin')expect(body).to include(meeting.participants[0].name)expect(body).to include(meeting.participants[1].name)end@@ -197,12 +200,13 @@ RSpec.describe MeetingMailer docontext 'with a recipient with another time zone' dolet!(:preference) { create(:user_preference, user: watcher1, time_zone: 'Asia/Tokyo') }- let(:mail) { described_class.content_for_review meeting_agenda, 'meeting_agenda', watcher1 }+ let(:mail) { described_class.icalendar_notification(meeting, watcher1, author) }it 'renders the mail with the correct locale' doexpect(mail.text_part.body).to include('01/19/2021 07:00 PM-08:00 PM (GMT+09:00) Asia/Tokyo')expect(mail.text_part.body).to include("#{author.name} has put the")- expect(mail.html_part.body).to include('01/19/2021 07:00 PM-08:00 PM (GMT+09:00) Asia/Tokyo')+ expect(mail.html_part.body).to include('01/19/2021 07:00 PM')+ expect(mail.html_part.body).to include('08:00 PM (GMT+09:00) Asia/Tokyo')expect(mail.html_part.body).to include("#{author.name} has put the")expect(mail.to).to contain_exactly(watcher1.mail)@@ -218,7 +222,7 @@ RSpec.describe MeetingMailer doenddescribe 'it renders november 9th for Berlin zone' do- let(:mail) { described_class.icalendar_notification meeting_agenda, 'meeting_agenda', author }+ let(:mail) { described_class.icalendar_notification(meeting, watcher1, author) }it 'renders the mail with the correct locale' doexpect(mail.text_part.body).to include('11/09/2021 11:00 PM-12:00 AM (GMT+01:00) Europe/Berlin')@@ -229,7 +233,7 @@ RSpec.describe MeetingMailer doenddescribe 'it renders november 10th for Tokyo zone' do- let(:mail) { described_class.icalendar_notification meeting_agenda, 'meeting_agenda', watcher1 }+ let(:mail) { described_class.icalendar_notification(meeting, watcher1, author) }let!(:preference) { create(:user_preference, user: watcher1, time_zone: 'Asia/Tokyo') }it 'renders the mail with the correct locale' dodiff --git a/spec/mailers/previews/meeting_mailer_preview.rb b/spec/mailers/previews/meeting_mailer_preview.rbindex 705fd244500..5bde2a15d83 100644--- a/spec/mailers/previews/meeting_mailer_preview.rb+++ b/spec/mailers/previews/meeting_mailer_preview.rb@@ -44,4 +44,13 @@ class MeetingMailerPreview < ActionMailer::PreviewMeetingMailer.rescheduled(meeting, user, actor, changes:)end++ def invited+ language = params['locale'] || I18n.default_locale+ actor = FactoryBot.build_stubbed(:user, lastname: 'Actor')+ user = FactoryBot.build_stubbed(:user, language:)+ meeting = FactoryBot.build_stubbed(:meeting)++ MeetingMailer.invited(meeting, user, actor)+ endend