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
Fix generation logic
Klaus Zanders6f9b4b721f93
diff --git a/modules/meeting/app/services/meetings/icalendar_builder.rb b/modules/meeting/app/services/meetings/icalendar_builder.rbindex b366d4669ee..b31c46f2770 100644--- a/modules/meeting/app/services/meetings/icalendar_builder.rb+++ b/modules/meeting/app/services/meetings/icalendar_builder.rb@@ -199,14 +199,19 @@ module Meetingstz = Icalendar::Timezone.newtz.tzid = tzid- transitions = timezone.tzinfo.transitions_up_to(all_times.max, all_times.min)- transitions.each do |tr|- comp = tr.offset.dst? ? Icalendar::Timezone::Daylight.new : Icalendar::Timezone::Standard.new- comp.dtstart = tr.at.utc.strftime("%Y%m%dT%H%M%SZ")- comp.tzoffsetfrom = format_ical_offset(tr.previous_offset.utc_total_offset)- comp.tzoffsetto = format_ical_offset(tr.offset.utc_total_offset)- comp.tzname = tr.offset.abbreviation.to_s- tz.add_component(comp)+ # We are investigating how to properly build this ... for now let's+ # just include everything from min - 6 months to max + 6 months+ if all_times.present?+ transitions = timezone.tzinfo.transitions_up_to(all_times.max + 6.months, all_times.min - 6.months)++ transitions.each do |tr|+ comp = tr.offset.dst? ? Icalendar::Timezone::Daylight.new : Icalendar::Timezone::Standard.new+ comp.dtstart = tr.at.utc.strftime("%Y%m%dT%H%M%SZ")+ comp.tzoffsetfrom = format_ical_offset(tr.previous_offset.utc_total_offset)+ comp.tzoffsetto = format_ical_offset(tr.offset.utc_total_offset)+ comp.tzname = tr.offset.abbreviation.to_s+ tz.add_component(comp)+ endendtzdiff --git a/modules/meeting/spec/mailers/meeting_mailer_spec.rb b/modules/meeting/spec/mailers/meeting_mailer_spec.rbindex 8c847c3c6c8..1661311fe39 100644--- a/modules/meeting/spec/mailers/meeting_mailer_spec.rb+++ b/modules/meeting/spec/mailers/meeting_mailer_spec.rb@@ -255,8 +255,8 @@ RSpec.describe MeetingMailer doexpect(entry.dtstart.utc).to eq meeting.start_timeexpect(entry.dtend.utc).to eq meeting.start_time + 1.hour- expect(entry.summary).to eq "[My project] Important meeting"- expect(entry.description).to eq "[My project] Meeting: Important meeting"+ expect(entry.summary).to eq "Important meeting"+ expect(entry.description).to eq "Important meeting"expect(entry.location).to eq(meeting.location.presence)enddiff --git a/modules/meeting/spec/mailers/meeting_series_mailer_spec.rb b/modules/meeting/spec/mailers/meeting_series_mailer_spec.rbindex d7bb6e21685..8fabb6d8806 100644--- a/modules/meeting/spec/mailers/meeting_series_mailer_spec.rb+++ b/modules/meeting/spec/mailers/meeting_series_mailer_spec.rb@@ -50,6 +50,7 @@ RSpec.describe MeetingSeriesMailer dolet(:i18n) doClass.new doinclude Redmine::I18n+public :format_date, :format_timeendend@@ -136,8 +137,8 @@ RSpec.describe MeetingSeriesMailer doexpect(parsed).to be_a Arrayexpect(parsed.length).to eq 1- expect(entry.summary).to eq "[My project] Recurring Standup"- expect(entry.description).to eq "[My project] Meeting series: Recurring Standup"+ expect(entry.summary).to eq "Recurring Standup"+ expect(entry.description).to eq "Recurring Standup"expect(entry.location).to eq(series.template&.location.presence)endenddiff --git a/modules/meeting/spec/services/all_meetings/ical_service_spec.rb b/modules/meeting/spec/services/all_meetings/ical_service_spec.rbindex 8f46ac62c80..c091b0cbfc1 100644--- a/modules/meeting/spec/services/all_meetings/ical_service_spec.rb+++ b/modules/meeting/spec/services/all_meetings/ical_service_spec.rb@@ -133,8 +133,8 @@ RSpec.describe AllMeetings::ICalService, type: :model do # rubocop:disable RSpecexpect(entry.attendee.map(&:to_s)).to match_array([user, user2].map { |u| "mailto:#{u.mail}" })expect(entry.dtstart.utc).to eq meeting.start_timeexpect(entry.dtend.utc).to eq meeting.start_time + 1.hour- expect(entry.summary).to eq "[My Project] Important meeting"- expect(entry.description).to eq "[My Project] Meeting: Important meeting"+ expect(entry.summary).to eq "Important meeting"+ expect(entry.description).to eq "Important meeting"expect(entry.location).to eq(meeting.location.presence)expect(entry.dtstart).to eq (relevant_time + 1.week).in_time_zone("Europe/Berlin")expect(entry.dtend).to eq (relevant_time + 1.week + 1.hour).in_time_zone("Europe/Berlin")@@ -183,8 +183,8 @@ RSpec.describe AllMeetings::ICalService, type: :model do # rubocop:disable RSpecexpect(entry.uid).to eq(recurring_meeting.uid)expect(entry.organizer.to_s).to eq("mailto:#{Setting.mail_from}")expect(entry.attendee.map(&:to_s)).to match_array([user, user2].map { |u| "mailto:#{u.mail}" })- expect(entry.summary).to eq "[My Project] Recurring meeting"- expect(entry.description).to eq "[My Project] Meeting series: Recurring meeting"+ expect(entry.summary).to eq "Recurring meeting"+ expect(entry.description).to eq "Recurring meeting"expect(entry.location).to eq(recurring_meeting.template.location.presence)expect(entry.exdate).to be_empty@@ -225,8 +225,8 @@ RSpec.describe AllMeetings::ICalService, type: :model do # rubocop:disable RSpecexpect(entry.recurrence_id).to eq(meeting.scheduled_meeting.start_time)expect(entry.organizer.to_s).to eq("mailto:#{Setting.mail_from}")expect(entry.attendee).to be_empty- expect(entry.summary).to eq "[My Project] Recurring meeting"- expect(entry.description).to eq "[My Project] Meeting series: Recurring meeting"+ expect(entry.summary).to eq "Recurring meeting"+ expect(entry.description).to eq "Recurring meeting"expect(entry.location).to eq(recurring_meeting.template.location.presence)expect(entry.sequence).to eq(meeting.lock_version)expect(entry.status).to eq "CONFIRMED"diff --git a/modules/meeting/spec/services/meetings/ical_service_spec.rb b/modules/meeting/spec/services/meetings/ical_service_spec.rbindex d4f59cbc445..7600f23b0f1 100644--- a/modules/meeting/spec/services/meetings/ical_service_spec.rb+++ b/modules/meeting/spec/services/meetings/ical_service_spec.rb@@ -84,17 +84,17 @@ RSpec.describe Meetings::ICalService, type: :model do # rubocop:disable RSpec/Spexpect(entry.attendee.map(&:to_s)).to contain_exactly("mailto:[email protected]", "mailto:[email protected]")expect(entry.dtstart.utc).to eq meeting.start_timeexpect(entry.dtend.utc).to eq meeting.start_time + 1.hour- expect(entry.summary).to eq "[My Project] Important meeting"- expect(entry.description).to eq "[My Project] Meeting: Important meeting"+ expect(entry.summary).to eq "Important meeting"+ expect(entry.description).to eq "Important meeting"expect(entry.location).to eq(meeting.location.presence)expect(entry.dtstart).to eq Time.zone.parse("2021-01-19T10:00:00Z").in_time_zone("Europe/Berlin")expect(entry.dtend).to eq (Time.zone.parse("2021-01-19T10:00:00Z") + 1.hour).in_time_zone("Europe/Berlin")# do autogenerated ical timezone definitions match real DST switch times?standard = standard_zone.dtstart.to_time- real_standard = Time.zone.parse("01-11-2020 01:00:00")+ real_standard = Time.zone.parse("01-11-2020 06:00:00")daylight = daylight_zone.dtstart.to_time- real_daylight = Time.zone.parse("14-03-2021 03:00:00")+ real_daylight = Time.zone.parse("14-03-2021 07:00:00")expect(standard.strftime("%a, %d %b %Y %H:%M:%S")).to eq (real_standard.strftime("%a, %d %b %Y %H:%M:%S"))expect(daylight.strftime("%a, %d %b %Y %H:%M:%S")).to eq (real_daylight.strftime("%a, %d %b %Y %H:%M:%S"))enddiff --git a/modules/meeting/spec/services/meetings/icalendar_builder_spec.rb b/modules/meeting/spec/services/meetings/icalendar_builder_spec.rbindex 10b87fd79b0..f40029ea18e 100644--- a/modules/meeting/spec/services/meetings/icalendar_builder_spec.rb+++ b/modules/meeting/spec/services/meetings/icalendar_builder_spec.rb@@ -144,8 +144,8 @@ RSpec.describe Meetings::IcalendarBuilder,expect(vtimezone_block).to be_presentstandard_count = vtimezone_block.scan("BEGIN:STANDARD").sizedaylight_count = vtimezone_block.scan("BEGIN:DAYLIGHT").size- expect(standard_count).to eq(2)- expect(daylight_count).to eq(2)+ expect(standard_count).to eq(4)+ expect(daylight_count).to eq(4)endendenddiff --git a/modules/meeting/spec/services/recurring_meetings/ical_service_spec.rb b/modules/meeting/spec/services/recurring_meetings/ical_service_spec.rbindex 83a6fecab8b..f4982a6825c 100644--- a/modules/meeting/spec/services/recurring_meetings/ical_service_spec.rb+++ b/modules/meeting/spec/services/recurring_meetings/ical_service_spec.rb@@ -75,7 +75,7 @@ RSpec.describe RecurringMeetings::ICalService, type: :model do # rubocop:disableit "contains serise and template information" doexpect(parsed_events.count).to eq(1)expect(series_ical).to include("LOCATION:https://example.com/meet/important-meeting")- expect(series_ical).to include("SUMMARY:[My Project] Weekly")+ expect(series_ical).to include("SUMMARY:Weekly")expect(series_ical).to include("CN=OpenProject:mailto:[email protected]")expect(series_ical).to include("ATTENDEE;CN=Bob Barker;[email protected];PARTSTAT=NEEDS-ACTION;RSVP=TRU")expect(series_ical).to include("ATTENDEE;CN=Foo Fooer;[email protected];PARTSTAT=NEEDS-ACTION;RSVP=TRUE")@@ -97,7 +97,7 @@ RSpec.describe RecurringMeetings::ICalService, type: :model do # rubocop:disableit "contains serise and template information" doexpect(parsed_events.count).to eq(1)expect(series_ical).to include("LOCATION:https://example.com/meet/important-meeting")- expect(series_ical).to include("SUMMARY:[My Project] Weekly")+ expect(series_ical).to include("SUMMARY:Weekly")expect(series_ical).to include("ATTENDEE;CN=Bob Barker;[email protected];PARTSTAT=NEEDS-ACTION;RSVP=TRU")expect(series_ical).to include("ATTENDEE;CN=Foo Fooer;[email protected];PARTSTAT=NEEDS-ACTION;RSVP=TRUE")expect(series_ical).to include("RRULE:FREQ=WEEKLY")