Fix persistent two factor auth notification.
authorCamila <hello@camila.codes>
Wed, 21 Sep 2022 15:22:01 +0000 (17:22 +0200)
committerCamila (Rebase PR Action) <hello@camila.codes>
Tue, 27 Sep 2022 14:49:29 +0000 (14:49 +0000)
The server app returns a 202 code when the request succeeded, which was
not taken into account.

Signed-off-by: Camila <hello@camila.codes>
src/gui/ocsjob.h
src/gui/tray/ActivityActionButton.qml
src/gui/tray/ActivityItemActions.qml
src/gui/tray/usermodel.cpp

index a6ee88f86b2dc5a082f801af6a400bdbe08637e2..e3b8b475d25bad2e1aba6b350d95b3e58a87cb54 100644 (file)
@@ -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
 
index 53ae3f40a750b207e5e38602a226b23c8e0a797f..a6b0d70da297bd891f5eb0855dc2eb45cae72c30 100644 (file)
@@ -10,7 +10,7 @@ Item {
     property string text: ""
     property string toolTipText: ""
 
-    property bool bold: false
+    property bool primaryButton: false
 
     property string imageSource: ""
     property string imageSourceHover: ""
@@ -18,12 +18,10 @@ Item {
     property color textColor: Style.ncTextColor
     property color textColorHovered: Style.ncSecondaryTextColor
 
-    property bool primaryButton: false
-
     signal clicked()
 
     Loader {
-        active: root.imageSource === "" && !primaryButton
+        active: !root.primaryButton
 
         anchors.fill: parent
 
@@ -40,7 +38,7 @@ Item {
     }
 
     Loader {
-        active: root.imageSource !== "" || primaryButton
+        active: root.primaryButton
 
         anchors.fill: parent
 
@@ -55,7 +53,7 @@ Item {
             textColor: root.textColor
             textColorHovered: root.textColorHovered
 
-            bold: root.bold
+            bold: root.primaryButton
 
             imageSource: root.imageSource
             imageSourceHover: root.imageSourceHover
index 40934fea6098a3e3868302ec550600ddef968e09..130a515665eb68ff67137917c10c04a568a50e9a 100644 (file)
@@ -46,10 +46,9 @@ RowLayout {
             imageSource: model.modelData.imageSource ? model.modelData.imageSource + root.adjustedHeaderColor : ""
             imageSourceHover: model.modelData.imageSourceHovered ? model.modelData.imageSourceHovered + UserModel.currentUser.headerTextColor : ""
 
-            textColor: imageSource !== "" || primary ? root.adjustedHeaderColor : Style.ncTextColor
-            textColorHovered: imageSource !== "" || primary ? UserModel.currentUser.headerTextColor : Style.ncTextColor
+            textColor: primary ? root.adjustedHeaderColor : Style.ncTextColor
+            textColorHovered: primary ? UserModel.currentUser.headerTextColor : Style.ncTextColor
 
-            bold: primary
             primaryButton: primary
 
             onClicked: !isTalkReplyButton ? root.triggerAction(model.index) : root.showReplyField()
index 23b4d5841458dd7611757ef82565c05411d32c19..76a857064eaed6192fc2c91c47fa2a8b4f509ed1 100644 (file)
@@ -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