From 79194c44df62a9ef207ea5969413a23482dd7906 Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Mon, 29 Jan 2024 10:08:09 +0530 Subject: [PATCH] Fix event cancellation status in export (#5107) --- #### Does this PR need a docs update or release note? - [ ] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [x] :no_entry: No #### Type of change - [ ] :sunflower: Feature - [x] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Supportability/Tests - [ ] :computer: CI/Deployment - [ ] :broom: Tech Debt/Cleanup #### Issue(s) * # #### Test Plan - [ ] :muscle: Manual - [x] :zap: Unit test - [ ] :green_heart: E2E --- src/internal/converters/ics/ics.go | 2 +- src/internal/converters/ics/ics_test.go | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/internal/converters/ics/ics.go b/src/internal/converters/ics/ics.go index 1aceccd1f..291d78bdf 100644 --- a/src/internal/converters/ics/ics.go +++ b/src/internal/converters/ics/ics.go @@ -339,7 +339,7 @@ func updateEventProperties(ctx context.Context, event models.Eventable, iCalEven // STATUS - https://www.rfc-editor.org/rfc/rfc5545#section-3.8.1.11 cancelled := event.GetIsCancelled() - if cancelled != nil { + if cancelled != nil && ptr.Val(cancelled) { iCalEvent.SetStatus(ics.ObjectStatusCancelled) } diff --git a/src/internal/converters/ics/ics_test.go b/src/internal/converters/ics/ics_test.go index f1434f615..798d2f595 100644 --- a/src/internal/converters/ics/ics_test.go +++ b/src/internal/converters/ics/ics_test.go @@ -576,6 +576,19 @@ func (suite *ICSUnitSuite) TestEventConversion() { assert.Contains(t, out, "STATUS:CANCELLED", "cancelled status") }, }, + { + name: "not cancelled event", + event: func() *models.Event { + e := baseEvent() + + e.SetIsCancelled(ptr.To(false)) + + return e + }, + check: func(out string) { + assert.NotContains(t, out, "STATUS:CANCELLED", "cancelled status") + }, + }, { name: "text body", event: func() *models.Event {