From f3513aaafe85e9787c28c9158ed86cabfae6b890 Mon Sep 17 00:00:00 2001 From: Camila Date: Tue, 20 Sep 2022 20:50:12 +0200 Subject: [PATCH 1/2] Fix two factor auth notification: 'Approve' link is a primary action. Signed-off-by: Camila --- src/gui/tray/ActivityActionButton.qml | 6 ++++-- src/gui/tray/ActivityItemActions.qml | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/tray/ActivityActionButton.qml b/src/gui/tray/ActivityActionButton.qml index eca55ebdcbd0c..53ae3f40a750b 100644 --- a/src/gui/tray/ActivityActionButton.qml +++ b/src/gui/tray/ActivityActionButton.qml @@ -18,10 +18,12 @@ Item { property color textColor: Style.ncTextColor property color textColorHovered: Style.ncSecondaryTextColor + property bool primaryButton: false + signal clicked() Loader { - active: root.imageSource === "" + active: root.imageSource === "" && !primaryButton anchors.fill: parent @@ -38,7 +40,7 @@ Item { } Loader { - active: root.imageSource !== "" + active: root.imageSource !== "" || primaryButton anchors.fill: parent diff --git a/src/gui/tray/ActivityItemActions.qml b/src/gui/tray/ActivityItemActions.qml index 6d9da41822407..40934fea6098a 100644 --- a/src/gui/tray/ActivityItemActions.qml +++ b/src/gui/tray/ActivityItemActions.qml @@ -34,7 +34,7 @@ RowLayout { id: activityActionButton readonly property string verb: model.modelData.verb - readonly property bool primary: model.index === 0 && verb !== "DELETE" + readonly property bool primary: (model.index === 0 && verb !== "DELETE") || model.modelData.primary readonly property bool isTalkReplyButton: verb === "REPLY" Layout.minimumWidth: primary ? Style.activityItemActionPrimaryButtonMinWidth : Style.activityItemActionSecondaryButtonMinWidth @@ -46,10 +46,11 @@ RowLayout { imageSource: model.modelData.imageSource ? model.modelData.imageSource + root.adjustedHeaderColor : "" imageSourceHover: model.modelData.imageSourceHovered ? model.modelData.imageSourceHovered + UserModel.currentUser.headerTextColor : "" - textColor: imageSource !== "" ? root.adjustedHeaderColor : Style.ncTextColor - textColorHovered: imageSource !== "" ? UserModel.currentUser.headerTextColor : Style.ncTextColor + textColor: imageSource !== "" || primary ? root.adjustedHeaderColor : Style.ncTextColor + textColorHovered: imageSource !== "" || primary ? UserModel.currentUser.headerTextColor : Style.ncTextColor bold: primary + primaryButton: primary onClicked: !isTalkReplyButton ? root.triggerAction(model.index) : root.showReplyField() } From 348c9ea91552cdbed2ef2505b7309dade5e3c833 Mon Sep 17 00:00:00 2001 From: Camila Date: Wed, 21 Sep 2022 17:22:01 +0200 Subject: [PATCH 2/2] 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/ActivityActionButton.qml | 10 ++++------ src/gui/tray/ActivityItemActions.qml | 5 ++--- src/gui/tray/usermodel.cpp | 6 ++++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/gui/ocsjob.h b/src/gui/ocsjob.h index a6ee88f86b2dc..e3b8b475d25ba 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/ActivityActionButton.qml b/src/gui/tray/ActivityActionButton.qml index 53ae3f40a750b..a6b0d70da297b 100644 --- a/src/gui/tray/ActivityActionButton.qml +++ b/src/gui/tray/ActivityActionButton.qml @@ -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 diff --git a/src/gui/tray/ActivityItemActions.qml b/src/gui/tray/ActivityItemActions.qml index 40934fea6098a..130a515665eb6 100644 --- a/src/gui/tray/ActivityItemActions.qml +++ b/src/gui/tray/ActivityItemActions.qml @@ -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() diff --git a/src/gui/tray/usermodel.cpp b/src/gui/tray/usermodel.cpp index 23b4d5841458d..76a857064eaed 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