From 9a181280a36b14624644337ba4360f9a91aab263 Mon Sep 17 00:00:00 2001 From: Camila Date: Wed, 21 Sep 2022 17:22:01 +0200 Subject: [PATCH] Fix persistent two factor auth notification. The server app returns a 202 code when the request succeeded, which was not taken into account. Signed-off-by: Camila --- src/gui/ocsjob.h | 2 ++ src/gui/tray/usermodel.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/ocsjob.h b/src/gui/ocsjob.h index a6ee88f86b2d..e3b8b475d25b 100644 --- a/src/gui/ocsjob.h +++ b/src/gui/ocsjob.h @@ -26,6 +26,8 @@ #define OCS_SUCCESS_STATUS_CODE 100 // Apparantly the v2.php URLs can return that #define OCS_SUCCESS_STATUS_CODE_V2 200 +// Two factor auth notification returns Accepted 202 +#define OCS_ACCEPTED_STATUS_CODE 202 // not modified when using ETag #define OCS_NOT_MODIFIED_STATUS_CODE_V2 304 diff --git a/src/gui/tray/usermodel.cpp b/src/gui/tray/usermodel.cpp index 27e9b3bd89fd..ea2764b344a8 100644 --- a/src/gui/tray/usermodel.cpp +++ b/src/gui/tray/usermodel.cpp @@ -342,8 +342,10 @@ void User::slotNotificationRequestFinished(int statusCode) { int row = sender()->property("activityRow").toInt(); - // the ocs API returns stat code 100 or 200 inside the xml if it succeeded. - if (statusCode != OCS_SUCCESS_STATUS_CODE && statusCode != OCS_SUCCESS_STATUS_CODE_V2) { + // the ocs API returns stat code 100 or 200 or 202 inside the xml if it succeeded. + if (statusCode != OCS_SUCCESS_STATUS_CODE + && statusCode != OCS_SUCCESS_STATUS_CODE_V2 + && statusCode != OCS_ACCEPTED_STATUS_CODE) { qCWarning(lcActivity) << "Notification Request to Server failed, leave notification visible."; } else { // to do use the model to rebuild the list or remove the item