Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix two factor authentication notification #4967

Merged
merged 2 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/gui/ocsjob.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/gui/tray/ActivityActionButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand All @@ -21,7 +21,7 @@ Item {
signal clicked()

Loader {
active: root.imageSource === ""
active: !root.primaryButton

anchors.fill: parent

Expand All @@ -38,7 +38,7 @@ Item {
}

Loader {
active: root.imageSource !== ""
active: root.primaryButton

anchors.fill: parent

Expand All @@ -53,7 +53,7 @@ Item {
textColor: root.textColor
textColorHovered: root.textColorHovered

bold: root.bold
bold: root.primaryButton

imageSource: root.imageSource
imageSourceHover: root.imageSourceHover
Expand Down
8 changes: 4 additions & 4 deletions src/gui/tray/ActivityItemActions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,10 +46,10 @@ 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: primary ? root.adjustedHeaderColor : Style.ncTextColor
textColorHovered: primary ? UserModel.currentUser.headerTextColor : Style.ncTextColor

bold: primary
primaryButton: primary

onClicked: !isTalkReplyButton ? root.triggerAction(model.index) : root.showReplyField()
}
Expand Down
6 changes: 4 additions & 2 deletions src/gui/tray/usermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down