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

refactor: move vuex user to pinia #10240

Merged
merged 5 commits into from
Jan 4, 2024
Merged

Conversation

JammingBen
Copy link
Contributor

@JammingBen JammingBen commented Dec 22, 2023

Description

Moves the user from the vuex store to pinia.

Also removes loading the old OCS user since it now lives in the Graph API. This means that the user sitting in the store now looks a bit different. The changes are:

  • uuid -> id
  • id -> onPremisesSamAccountName
  • email -> mail
  • displayname -> displayName
  • groups -> memberOf

This also means that the quota is now being handled on the user's personal drive instead of on the user itself. On a drive item this looks like this:

{
    [...]
    quota: {
        remaining: 4658892800,
        state: "normal",
        total: 0,
        used: 15091902
    }
}

How to

The user can be retrieved via the useUserStore composable like so:

const userStore = useUserStore()
const user = userStore.user

There is no need to unref userStore.user since it behaves like Vue's reactive. You only need to be careful when destructuring the user since it would lose reactivity. To compensate for that you can use pinia's storeToRefs method:

const userStore = useUserStore()
const { user } = storeToRefs(userStore)

Note that you need to unref the user then though.

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

@JammingBen JammingBen self-assigned this Dec 22, 2023
Copy link

update-docs bot commented Dec 22, 2023

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@JammingBen JammingBen changed the title refactor: move vuex store to pinia refactor: move vuex user to pinia Dec 22, 2023
@JammingBen JammingBen mentioned this pull request Dec 22, 2023
11 tasks
@JammingBen JammingBen force-pushed the vuex-user-store-to-piniia branch from c930ce2 to cbc42c9 Compare December 22, 2023 14:39
@JammingBen JammingBen force-pushed the vuex-user-store-to-piniia branch 4 times, most recently from 910b3ea to 9dd71c7 Compare January 2, 2024 09:23
@JammingBen JammingBen mentioned this pull request Jan 3, 2024
@JammingBen JammingBen force-pushed the vuex-user-store-to-piniia branch 2 times, most recently from 5af5f02 to df9d6ce Compare January 3, 2024 14:53
@JammingBen JammingBen marked this pull request as ready for review January 3, 2024 14:53
@JammingBen JammingBen force-pushed the vuex-user-store-to-piniia branch 3 times, most recently from 4d673dc to 8ed50fb Compare January 3, 2024 15:32
@JammingBen JammingBen requested review from dschmidt and kulmann January 3, 2024 16:09
Copy link
Contributor

@kulmann kulmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 😍

packages/web-runtime/src/store/config.ts Show resolved Hide resolved
changelog/unreleased/change-remove-ocs-user Outdated Show resolved Hide resolved
@JammingBen JammingBen force-pushed the vuex-user-store-to-piniia branch from 8ed50fb to 870e32c Compare January 4, 2024 14:25
Copy link

sonarqubecloud bot commented Jan 4, 2024

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

11 New issues
0 Security Hotspots
59.6% Coverage on New Code
0.4% Duplication on New Code

See analysis details on SonarCloud

@JammingBen JammingBen merged commit d0ffc83 into master Jan 4, 2024
3 checks passed
@delete-merged-branch delete-merged-branch bot deleted the vuex-user-store-to-piniia branch January 4, 2024 16:30
@JammingBen JammingBen mentioned this pull request Jan 19, 2024
7 tasks
@micbar micbar mentioned this pull request Jun 19, 2024
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants