-
Notifications
You must be signed in to change notification settings - Fork 159
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: remove share status in favour of syncEnabled #10421
Conversation
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. |
36ef6ec
to
d9a7d0b
Compare
381d60f
to
51cf938
Compare
51cf938
to
f5150ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greeeeaaaaaat! 🎉
Personally I probably wouldn't have gotten rid of the ShareStatus enum/class just yet, because I feel the magic numbers will be harder to review in the upcoming iterations ... but I wouldn't revert the change now either
resource.status = parseInt(share.state) | ||
resource.hidden = share.hidden === 'true' || share.hidden === true | ||
;(resource as IncomingShareResource).syncEnabled = parseInt(share.state) === 0 | ||
;(resource as IncomingShareResource).hidden = share.hidden === 'true' || share.hidden === true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you already implemented type predicates, can't we somehow narrow the type down here properly reasonably instead of just casting it?
https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be removed later today, so I decided to not invest any time 😄
Edit: see #10426
return false | ||
} | ||
if (isIncomingShareResource(resources[0]) && !resources[0].syncEnabled) { | ||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweeeeeeeeeeeeeeeeeeeeeeeeeeeeet
resource, | ||
status: resource.status, | ||
status: resource.syncEnabled ? 0 : 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably for the time being until we're moving towards the graph client completely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be removed as one of the next steps, so again I decided to not invest much time into making it more readable.
client, | ||
hidden = undefined, | ||
spaces = [], | ||
fullShareOwnerPaths = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminds me - have you tried this with fullShareOwnerPaths? 🙈 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, it will probably break eventually with the transition to sharing NG (or tbh I think the first PR already broke it 😅 ). But I'd like to get this transition going first, especially because code paths like these will change in a few days anyway.
I added it to the epic though: #10418
Yeah, I was thinking about the same but decided for the clean cut here because the remaining magic numbers will be removed as one of the next steps anyway (which is basically the |
3443f1c
to
8fcd572
Compare
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 8 New issues |
Description
Remove share status in favour of the
syncEnabled
property since sharing NG won't have share statuses anymore. Also renames the actions and test steps accordingly.The remaining places where we still use the status (e.g.
triggerShareAction
) are deprecated and will be removed with one of the next changes.In addition to that I decided to introduce
OutgoingShareResource
andIncomingShareResource
interfaces that extendShareResoruce
, since some properties are only available on incoming share resources. This makes type checking easier and even allows us to kill some of the pesky route checks (e.g.IncomingShareResource
== "Shared with me" page).Related Issue
Types of changes