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

create file approve & reject urls #193

Merged
merged 7 commits into from
Apr 3, 2024

Conversation

madwort
Copy link
Contributor

@madwort madwort commented Mar 22, 2024

@madwort madwort force-pushed the madwort/implement-file-approval-frontend branch 2 times, most recently from ecb3fb7 to c1ef7c3 Compare March 22, 2024 15:52
if path == "":
file_approve_url = None
file_reject_url = None
else:
Copy link
Contributor Author

@madwort madwort Mar 27, 2024

Choose a reason for hiding this comment

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

nb. not a big fan of this big indent block, might refactor before asking for final review

Copy link
Contributor

Choose a reason for hiding this comment

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

Possible alternative: pass the file relpath as a POST parameter like we do for the workspace_add_file_to_request view, so the url is just /requests/approve/<str:request_id>/. The template logic already deals with things that are or aren't files (displaying content etc)

@madwort madwort force-pushed the madwort/implement-file-approval-frontend branch 3 times, most recently from c1356b1 to 0aec1ac Compare March 27, 2024 15:17
if path == "":
file_approve_url = None
file_reject_url = None
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible alternative: pass the file relpath as a POST parameter like we do for the workspace_add_file_to_request view, so the url is just /requests/approve/<str:request_id>/. The template logic already deals with things that are or aren't files (displaying content etc)

if existing_reviews[0].status == FileReviewStatus.APPROVED:
file_approve_url = None
else:
file_reject_url = None
Copy link
Contributor

Choose a reason for hiding this comment

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

This check could move to the ReleaseRequest, and do something similar to is_supporting_file to get the RequestFile from the UrlPath, and look at its reviews for this user. It shouldn't need to know about the group then.
(We also don't want to show approve or reject buttons for supporting files, so it'll need to check the filetype too)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have added handling for supporting files & refactored a bit to use ReleaseRequest rather than think about groups here

airlock/views/request.py Show resolved Hide resolved
airlock/views/request.py Outdated Show resolved Hide resolved
tests/integration/views/test_request.py Outdated Show resolved Hide resolved
@madwort madwort force-pushed the madwort/implement-file-approval-frontend branch 6 times, most recently from 0304705 to 466faf6 Compare March 28, 2024 17:01
airlock/business_logic.py Outdated Show resolved Hide resolved
@madwort madwort force-pushed the madwort/implement-file-approval-frontend branch 2 times, most recently from 027f572 to dad5591 Compare March 28, 2024 17:25
@madwort madwort marked this pull request as ready for review March 28, 2024 17:25
@@ -401,6 +401,16 @@ def output_files_set(self):
for request_file in filegroup.output_files
}

def get_file_review_for_reviewer(self, urlpath: UrlPath, reviewer: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a BLL method that calls down to the DAL (like get_release_request), rather than a method on ReleaseRequest? Then we can pass actually retrieving the file review down to the local_db provider, and it becomes a django FileReview.objects.filter(...).first()

Copy link
Contributor Author

@madwort madwort Apr 3, 2024

Choose a reason for hiding this comment

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

hmm, yeah, the original ticket specified a get_file_approvals() like that, which I initially did, and then removed after PR review from Simon #174 (review) in favour of keeping the interface between the BLL & DAL just the one big call with the entire state of everything.

Obviously a method that calls down to the DAL would have dodged the issue in tests with stale release_request objects, but refreshing the release_request seems ok in that situation?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could be the use case Simon mentioned for just getting a file review without the rest of the release request? Although, I guess we did fetch it all already, and getting the release request already extracted all the reviews from the database, so this avoids another db call

@madwort madwort force-pushed the madwort/implement-file-approval-frontend branch 2 times, most recently from e392a28 to 1cc8783 Compare April 3, 2024 11:43
@madwort madwort force-pushed the madwort/implement-file-approval-frontend branch from 1cc8783 to 1d63e5f Compare April 3, 2024 11:50
@madwort madwort force-pushed the madwort/implement-file-approval-frontend branch from 1d63e5f to ceecbac Compare April 3, 2024 11:50
@madwort madwort enabled auto-merge April 3, 2024 11:54
@madwort madwort merged commit ca893e2 into main Apr 3, 2024
8 checks passed
@madwort madwort deleted the madwort/implement-file-approval-frontend branch April 3, 2024 11:55
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.

Support approving/rejecting individual files
2 participants