TF-4069 Automatically reply should be deactivated vacation after end date

This commit is contained in:
dab246
2025-09-29 14:57:50 +07:00
committed by Dat H. Pham
parent 500a7e6a79
commit d6606aeb48
9 changed files with 117 additions and 75 deletions
@@ -0,0 +1,21 @@
import 'package:jmap_dart_client/jmap/mail/vacation/vacation_response.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
extension HandleVacationResponseExtension on ManageAccountDashBoardController {
void syncVacationResponse(VacationResponse? newVacation) {
if (newVacation?.vacationResponderIsStopped == true) {
automaticallyDeactivateVacation(newVacation!);
} else {
setUpVacation(newVacation);
}
}
void setUpVacation(VacationResponse? newVacation) {
vacationResponse.value = newVacation;
}
void automaticallyDeactivateVacation(VacationResponse vacationResponse) {
disableVacationResponder(vacationResponse);
}
}
@@ -87,6 +87,10 @@ extension VacationResponseExtension on VacationResponse {
htmlBody: htmlBody ?? this.htmlBody
);
}
VacationResponse clearAllExceptHtmlBody() {
return VacationResponse(isEnabled: false, htmlBody: htmlBody);
}
String getNotificationMessage(BuildContext context) {
if (vacationResponderIsValid) {