From 3aabee59dab2703aa9ec1402468bcfbf672cde94 Mon Sep 17 00:00:00 2001 From: dab246 Date: Fri, 7 Jun 2024 17:06:40 +0700 Subject: [PATCH] TF-2907 Disable `YES/NO/MAYBE` action for events when missing `METHOD/ORGANIZER/ATTENDEES` --- .../extensions/calendar_event_extension.dart | 4 ++ .../calendar_event_detail_widget.dart | 17 +++++---- .../calendar_event_information_widget.dart | 38 ++++++++++--------- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/lib/features/email/presentation/extensions/calendar_event_extension.dart b/lib/features/email/presentation/extensions/calendar_event_extension.dart index 1c7868b40..aec40e3ca 100644 --- a/lib/features/email/presentation/extensions/calendar_event_extension.dart +++ b/lib/features/email/presentation/extensions/calendar_event_extension.dart @@ -356,4 +356,8 @@ extension CalendarEventExtension on CalendarEvent { } return []; } + + bool get isDisplayedEventReplyAction => method != null + && organizer != null + && participants?.isNotEmpty == true; } \ No newline at end of file diff --git a/lib/features/email/presentation/widgets/calendar_event/calendar_event_detail_widget.dart b/lib/features/email/presentation/widgets/calendar_event/calendar_event_detail_widget.dart index 748bb307c..4cebe466c 100644 --- a/lib/features/email/presentation/widgets/calendar_event/calendar_event_detail_widget.dart +++ b/lib/features/email/presentation/widgets/calendar_event/calendar_event_detail_widget.dart @@ -101,15 +101,16 @@ class CalendarEventDetailWidget extends StatelessWidget { organizer: calendarEvent.organizer!, ), ), - CalendarEventActionButtonWidget( - onCalendarEventReplyActionClick: onCalendarEventReplyActionClick, - calendarEventReplying: calendarEventReplying, - presentationEmail: presentationEmail, - onMailToAttendeesAction: () => onMailtoAttendeesAction?.call( - calendarEvent.organizer, - calendarEvent.participants, + if (calendarEvent.isDisplayedEventReplyAction) + CalendarEventActionButtonWidget( + onCalendarEventReplyActionClick: onCalendarEventReplyActionClick, + calendarEventReplying: calendarEventReplying, + presentationEmail: presentationEmail, + onMailToAttendeesAction: () => onMailtoAttendeesAction?.call( + calendarEvent.organizer, + calendarEvent.participants, + ), ), - ), ], ), ); diff --git a/lib/features/email/presentation/widgets/calendar_event/calendar_event_information_widget.dart b/lib/features/email/presentation/widgets/calendar_event/calendar_event_information_widget.dart index fb65d3f25..f3f708b74 100644 --- a/lib/features/email/presentation/widgets/calendar_event/calendar_event_information_widget.dart +++ b/lib/features/email/presentation/widgets/calendar_event/calendar_event_information_widget.dart @@ -120,16 +120,17 @@ class CalendarEventInformationWidget extends StatelessWidget { organizer: calendarEvent.organizer!, ), ), - CalendarEventActionButtonWidget( - margin: EdgeInsetsDirectional.zero, - onCalendarEventReplyActionClick: onCalendarEventReplyActionClick, - calendarEventReplying: calendarEventReplying, - presentationEmail: presentationEmail, - onMailToAttendeesAction: () => onMailtoAttendeesAction?.call( - calendarEvent.organizer, - calendarEvent.participants, + if (calendarEvent.isDisplayedEventReplyAction) + CalendarEventActionButtonWidget( + margin: EdgeInsetsDirectional.zero, + onCalendarEventReplyActionClick: onCalendarEventReplyActionClick, + calendarEventReplying: calendarEventReplying, + presentationEmail: presentationEmail, + onMailToAttendeesAction: () => onMailtoAttendeesAction?.call( + calendarEvent.organizer, + calendarEvent.participants, + ), ), - ), ], ), ) @@ -195,16 +196,17 @@ class CalendarEventInformationWidget extends StatelessWidget { organizer: calendarEvent.organizer!, ), ), - CalendarEventActionButtonWidget( - margin: EdgeInsetsDirectional.zero, - onCalendarEventReplyActionClick: onCalendarEventReplyActionClick, - calendarEventReplying: calendarEventReplying, - presentationEmail: presentationEmail, - onMailToAttendeesAction: () => onMailtoAttendeesAction?.call( - calendarEvent.organizer, - calendarEvent.participants, + if (calendarEvent.isDisplayedEventReplyAction) + CalendarEventActionButtonWidget( + margin: EdgeInsetsDirectional.zero, + onCalendarEventReplyActionClick: onCalendarEventReplyActionClick, + calendarEventReplying: calendarEventReplying, + presentationEmail: presentationEmail, + onMailToAttendeesAction: () => onMailtoAttendeesAction?.call( + calendarEvent.organizer, + calendarEvent.participants, + ), ), - ), ], ), ))