Skip to content

Commit

Permalink
Add better uid and prodid
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Dec 6, 2024
1 parent d92edaa commit 0d09c40
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions modules/meeting/app/services/meetings/ical_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def ical_event(start_time, &)

def build_icalendar(start_time)
::Icalendar::Calendar.new.tap do |calendar|
calendar.prodid = "-//OpenProject GmbH//#{OpenProject::VERSION}//Meeting//EN"
ical_timezone = timezone.tzinfo.ical_timezone start_time
calendar.add_timezone ical_timezone
end
Expand All @@ -65,6 +66,10 @@ def add_attendees(event, meeting)
end
end

def ical_uid(suffix)
"#{Setting.app_title}-#{Setting.host_name}-#{suffix}".dasherize
end

def ical_datetime(time, timezone_id)
Icalendar::Values::DateTime.new time.in_time_zone(timezone_id), "tzid" => timezone_id
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def upcoming_instantiated_schedules
end

def base_series_attributes(event) # rubocop:disable Metrics/AbcSize
event.uid = "#{Setting.host_name}-meeting-series-#{series.id}"
event.uid = ical_uid("meeting-series-#{series.id}")
event.rrule = schedule.rrules.first.to_ical # We currently only have one recurrence rule
event.summary = "[#{series.project.name}] #{series.title}"
event.description = "[#{series.project.name}] #{I18n.t(:label_meeting_series)}: #{series.title}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
expect(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("UID:#{Setting.host_name}-meeting-series-#{series.id}")
expect(series_ical).to include("UID:#{Setting.app_title}-#{Setting.host_name}-meeting-series-#{series.id}")
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")
end
Expand Down

0 comments on commit 0d09c40

Please sign in to comment.