TF-3793 Hide warning message when use is organizer

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-06-20 12:45:42 +07:00
committed by Dat H. Pham
parent 1e054cc1e5
commit de5e717b57
2 changed files with 18 additions and 10 deletions
@@ -383,21 +383,31 @@ extension CalendarEventExtension on CalendarEvent {
return []; return [];
} }
bool isDisplayedEventReplyAction(String ownerEmailAddress) => method != null bool isDisplayedEventReplyAction(String ownerEmailAddress) =>
&& _methodIsRepliable method != null &&
&& organizer != null _methodIsRepliable &&
&& participants?.isNotEmpty == true organizer != null &&
&& !validateUserIsNotListedInParticipants(ownerEmailAddress); participants?.isNotEmpty == true &&
userIsListedInParticipants(ownerEmailAddress);
bool get _methodIsRepliable => bool get _methodIsRepliable =>
method == EventMethod.request || method == EventMethod.request ||
method == EventMethod.add || method == EventMethod.add ||
method == EventMethod.counter; method == EventMethod.counter;
bool validateUserIsNotListedInParticipants(String ownEmailAddress) { bool userIsListedInParticipants(String ownEmailAddress) {
final participant = participants?.firstWhereOrNull((participant) => final participant = participants?.firstWhereOrNull((participant) =>
participant.mailto?.mailAddress.value == ownEmailAddress); participant.mailto?.mailAddress.value == ownEmailAddress);
return participant == null; return participant != null;
}
bool userIsOrganizer(String ownEmailAddress) {
return organizer?.mailto?.value == ownEmailAddress;
}
bool isDisplayedWarningMessage(String ownerEmailAddress) {
return !userIsListedInParticipants(ownerEmailAddress) &&
!userIsOrganizer(ownerEmailAddress);
} }
bool get isDisplayedMailToAttendees => bool get isDisplayedMailToAttendees =>
@@ -149,9 +149,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
openEmailAddressDetailAction: openEmailAddressDetailAction, openEmailAddressDetailAction: openEmailAddressDetailAction,
), ),
), ),
if (calendarEvent.validateUserIsNotListedInParticipants( if (calendarEvent.isDisplayedWarningMessage(ownEmailAddress))
ownEmailAddress,
))
Padding( Padding(
padding: EdgeInsetsDirectional.only( padding: EdgeInsetsDirectional.only(
top: CalendarEventInformationWidgetStyles.fieldTopPadding, top: CalendarEventInformationWidgetStyles.fieldTopPadding,