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

DYN-6411 update version check #14583

Merged
merged 10 commits into from
Nov 14, 2023
Merged

Conversation

dnenov
Copy link
Collaborator

@dnenov dnenov commented Nov 8, 2023

Purpose

This is a PR fixing an issue where anyone could update a version of a package regardless of their ownership of the package. This issue has been flagged here https://jira.autodesk.com/browse/DYN-6411.

Also updates some of the UI elements as per the latest Figma design.

UI Changes

Publish Version... is disabled if not the package owner.

image

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

  • removed the ability to update package version if not the creator of the package
  • ui updates as per the latest Figma design

Reviewers

@avidit
@reddyashish

FYIs

@Amoursol

- removed the ability to update package version if not the creator of the package
- ui updates as per latest Figma design
@avidit avidit changed the title update version check DYN-6411 update version check Nov 8, 2023

if (_pubPkgView.IsLoaded && IsLoaded) _pubPkgView.Owner = this;
// setting the owner to the packageManagerWindow will centralize promts originating from the Package Manager
dynamoViewModel.Owner = packageManagerWindow;
Copy link
Contributor

Choose a reason for hiding this comment

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

This line does not look correct to me... did I miss anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The way I used it and the way I understand it is, whichever more major View 'takes control', gets ownership of this property. The same thing happens in the PreferencesView:

The Owner property is used when utilizing the MessageBoxService:

public static MessageBoxResult Show(Window owner,string msg, string title, MessageBoxButton button, MessageBoxImage img)

So when we launch message boxes from inside the DynamoViewModel, we are centralizing them around that Owner.

Another thing it does is to keep the reference of the current window high up in the hierarchy. For example, in one instance, we are calling the UnninstallCommand which is part of the PackageViewModel from deep inside the PacakgeManagerView. The PackageViewModel and the Uninstall method do not have a reference to the PackageManagerView, though, but they do have a reference to the DynamoViewModel. So when prompting the user, we are setting the Owner of the DynamoViewModel, which is the PackageManagerView, so the prompt is correctly centralized.

I did not do a good job of cleaning up this logic, the logic exists from before. Maybe I did not fully understand it myself, this is my current working logic of it.

Copy link
Contributor

Choose a reason for hiding this comment

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

After checking out the code, I think I understand what you are saying. I believe the Owner property was created so DynamoViewModel could have a reference to the view as a convenient way to raise message box with the Owner correctly passed in. But it is not meant to be served as the property indicating current Window, because I do not see any logic to reset that Owner property back to DynamoView. I can foresee a bug that after Preferences panel opened and dragged out of the screen, then closed, new message boxes using such owner will be out of DynamoView.

But thank you for pointing this out, I do think we provided bad examples in code so it's good for this PR but I will file a follow up task to address that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I understand. If you want me, I can try to trace all the moments where we are setting using message boxes and try to remove that need by setting the Onwer directly somehow.

@reddyashish reddyashish added this to the 3.0 milestone Nov 9, 2023
- renamed DynamoViewModelRequestRequestPackageManagerPublish
- renamed CanDeprecate to IsOwner
- now_searchPkgsView.Closed subscribes and unsubscribes explicitly
- if _searchPkgsView has been created, we will unsubscribe inside the DynamoView WindowClosed event
- updated the correct PackageManagerView to be targeted by the changes
@reddyashish
Copy link
Contributor

@dnenov 2 tests failing here:
Screenshot 2023-11-14 at 6 17 08 AM

- the 2 failing tests were referring to the outdated PublishPackageView
- now replaced with the PackageManagerView which contains the publish package ui
@reddyashish
Copy link
Contributor

@reddyashish reddyashish merged commit 697117b into DynamoDS:master Nov 14, 2023
17 checks passed
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.

3 participants