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 [];
}
bool isDisplayedEventReplyAction(String ownerEmailAddress) => method != null
&& _methodIsRepliable
&& organizer != null
&& participants?.isNotEmpty == true
&& !validateUserIsNotListedInParticipants(ownerEmailAddress);
bool isDisplayedEventReplyAction(String ownerEmailAddress) =>
method != null &&
_methodIsRepliable &&
organizer != null &&
participants?.isNotEmpty == true &&
userIsListedInParticipants(ownerEmailAddress);
bool get _methodIsRepliable =>
method == EventMethod.request ||
method == EventMethod.add ||
method == EventMethod.counter;
bool validateUserIsNotListedInParticipants(String ownEmailAddress) {
bool userIsListedInParticipants(String ownEmailAddress) {
final participant = participants?.firstWhereOrNull((participant) =>
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 =>
@@ -149,9 +149,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
openEmailAddressDetailAction: openEmailAddressDetailAction,
),
),
if (calendarEvent.validateUserIsNotListedInParticipants(
ownEmailAddress,
))
if (calendarEvent.isDisplayedWarningMessage(ownEmailAddress))
Padding(
padding: EdgeInsetsDirectional.only(
top: CalendarEventInformationWidgetStyles.fieldTopPadding,