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

API V3 Subproject Creation Bug fix #6275

Merged
merged 6 commits into from Oct 14, 2019

Conversation

@saadmk11
Copy link
Member

saadmk11 commented Oct 10, 2019

fixes: #6271

@saadmk11 saadmk11 requested review from humitos and readthedocs/core Oct 10, 2019
Copy link
Member

stsewd left a comment

Changes look good. I'm leaving some suggestions to have more explicit tests. Also, I'm pushing some tests for the UI form, I was in the process of fixing this when I saw this PR p:

Copy link
Member

stsewd left a comment

Oh, and looks like all validation errors from the subproject serializer are missing i18n, can you add it?

saadmk11 and others added 2 commits Oct 10, 2019
Co-Authored-By: Santos Gallegos <santos_g@outlook.com>
Co-Authored-By: Santos Gallegos <santos_g@outlook.com>
@saadmk11

This comment has been minimized.

Copy link
Member Author

saadmk11 commented Oct 10, 2019

Changes look good. I'm leaving some suggestions to have more explicit tests. Also, I'm pushing some tests for the UI form, I was in the process of fixing this when I saw this PR p:

Sure thanks :)

Oh, and looks like all validation errors from the subproject serializer are missing i18n, can you add it?

Okay :)

@saadmk11 saadmk11 requested a review from stsewd Oct 10, 2019
@stsewd
stsewd approved these changes Oct 10, 2019
@humitos humitos self-assigned this Oct 11, 2019
Copy link
Member

humitos left a comment

I was almost sure that I was going to make a mistake with this logic. I'm happy that you solved the issue. Thanks!

When working on this, I asked myself if it wouldn't be better to move the logic outside the Form and share it with the Serializer. After the bug that I introduced, I'd say it's clear that we have to do that instead of replicating the same logic. I want a function is_valid_as_subproject(project, subproject) raising different customized exceptions that we can handle properly on the Form and Serializer.

@saadmk11

This comment has been minimized.

Copy link
Member Author

saadmk11 commented Oct 11, 2019

I was almost sure that I was going to make a mistake with this logic. I'm happy that you solved the issue. Thanks!

When working on this, I asked myself if it wouldn't be better to move the logic outside the Form and share it with the Serializer. After the bug that I introduced, I'd say it's clear that we have to do that instead of replicating the same logic. I want a function is_valid_as_subproject(project, subproject) raising different customized exceptions that we can handle properly on the Form and Serializer.

I think we can have 2 methods that will check is_valid_as_subproject and is_valid_as_superproject or we can have 1 method that checks both like is_valid_project_relation(project, subproject). What do you suggest? :)

Should I update this PR with that or Its alright for now?

But not sure how to raise different customized exceptions that we can handle properly on the Form and Serializer without any hack. like passing the validation error class

@humitos humitos mentioned this pull request Oct 14, 2019
@humitos

This comment has been minimized.

Copy link
Member

humitos commented Oct 14, 2019

I think we can have 2 methods that will check is_valid_as_subproject and is_valid_as_superproject or we can have 1 method that checks both like is_valid_project_relation(project, subproject). What do you suggest? :)

Two methods are more explicit to me.

Should I update this PR with that or Its alright for now?

I think this refactor can be done in another PR. Do you want to work on that as well?

@humitos humitos merged commit 0e97aa4 into readthedocs:master Oct 14, 2019
2 checks passed
2 checks passed
continuous-documentation/read-the-docs Read the Docs build succeeded!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@saadmk11 saadmk11 deleted the saadmk11:subproject-bug branch Oct 14, 2019
@saadmk11

This comment has been minimized.

Copy link
Member Author

saadmk11 commented Oct 14, 2019

I think this refactor can be done in another PR. Do you want to work on that as well?

@humitos Sure! 👍 I'll send a PR Soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.