feat: preserve the last selected account between runs - #9061
Conversation
|
Sorry, it seems I've borked my github setup (haven't used github in a long time). |
i2h3
left a comment
There was a problem hiding this comment.
Does someone know if it is possible to remove the merge commit with the github cli (gh)?
I do not know about gh but in Git it would be an git rebase --interactive on master in which the merge commit is just dropped then. 🤔
Was overthinking it a bit 😅 |
|
@Aiiaiiio Seems you have been reviewing the previous attempt at implementing this thingy. Could you take a look at this one as well if you have some time? |
|
Not entirely sure what is wrong with the SonarCloud check. If someone could clarify whether the issue is on my side, I'd be grateful 👍 |
No worries. Should be ok now |
Aiiaiiio
left a comment
There was a problem hiding this comment.
Looks awesome! See my change request please. We can discuss if you disagree.
Still broken unfortunately. "Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator to check the permissions of the user the token belongs to" |
Head branch was pushed to by a user without write access
|
@Aiiaiiio sorry for dragging this thing on, but I think this version is the cleanest solution for now. |
Added an extra setting in the config that contains an account id to store the last one selected Modified usermodel logic to auto select the account using the id from the config Modified the account manager and user model to init user list after account restoration completes Signed-off-by: Dmytro Syzov <sizovdmitrij@gmail.com>
Signed-off-by: dsyzov <sizovdmitrij@gmail.com>
|
Artifact containing the AppImage: nextcloud-appimage-pr-9061.zip Digest: To test this change/fix you can download the above artifact file, unzip it, and run it. Please make sure to quit your existing Nextcloud app and backup your data. |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Description
Implements #8986 and #9035
This PR implements the feature to remember and restore the last selected account after the client restarts. Previously, the client would always select the first account on startup, which was frustrating for users with multiple accounts.
Changes Made
ConfigFile (
src/libsync/configfile.handconfigfile.cpp):lastSelectedAccountCconstant for the settings keylastSelectedAccount()getter methodsetLastSelectedAccount()setter methodUserModel (
src/gui/tray/usermodel.cpp):buildUserList()to restore the last selected account on startupsetCurrentUserId()to save the account id when user changes accountsHow It Works
buildUserList()attempts to restore the last selected accountTechnical Details
Testing
The fix has been manually tested. Unit test has not been added as an appropriate existing test for the relevant component was not found and creating it was deemed out of scope for this PR.
Screenshots
feat_preserve_acc.mp4
Notes
As account IDs are not randomly generated it is possible that a wrong account will be selected if somehow the original one was deleted and another one was created in its place outside the client.