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
frontsite: patron can cancel its own literature request #746
frontsite: patron can cancel its own literature request #746
Conversation
topless
commented
Feb 17, 2020
- closes patron cancel literature request #743
c25ea1f
to
99f5fcf
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.
Currently, I see that dreqid
had update_permission_factory_imp=backoffice_permission,
so the patron will not be able to update it.
Did you try to be logged in as the Patron that created the request?
9e29ce5
to
6564b0e
Compare
c0024f7
to
23acb2e
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.
It looks neat! Thanks a lot for the refactoring! I find it more clear to understand now. Good job!
invenio_app_ils/document_requests/loaders/jsonschemas/document_request_accept.py
Outdated
Show resolved
Hide resolved
|
||
class Meta: | ||
"""Meta attributes for the schema.""" | ||
|
||
unknown = EXCLUDE | ||
|
||
remove_fields = fields.List(fields.Str()) | ||
document_pid = fields.Str() |
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 not mandatory because on delete there is no document_pid
payload, right?
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.
Exactly, if we want to be super conservative, in a previous commit, I was actually submitting the document_pid and I was checking if it matches the one we are trying to remove. We can go down either path wdyt?
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.
I think it is good enough! :)
I would maybe add a comment that on POST you have it, and on DELETE no.
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.
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.
@ntarocco I have made the document_pid
required, and now I am submitting it also in the DELETE
request. The main reason for that is that I didn't find a simple way to pass partial=True
to the load method. As far I understood this is the place where the load()
is called: https://github.com/inveniosoftware/invenio-records-rest/blob/526dcaef46dfe79acf737feee4570fd6e0b25679/invenio_records_rest/loaders/marshmallow.py#L91. According to the documentation for partial it should be something like `.load(request_json, partial=True). In invenio-records-rest we don't allow extra params to be passed down to load function. There are ways to fix/cheat this around, I am looking forward for you input cause I might have missed something in the process.
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 it concerns, submitting data with DELETE
there is a worth reading SO question https://stackoverflow.com/questions/299628/is-an-entity-body-allowed-for-an-http-delete-request, and a related comment on axios github axios/axios#897 (comment)
...t/DocumentRequestDetails/components/DocumentRequestSteps/components/ReviewStep/ReviewStep.js
Outdated
Show resolved
Hide resolved
...pages/frontsite/PatronProfile/PatronCurrentDocumentRequests/PatronCurrentDocumentRequests.js
Outdated
Show resolved
Hide resolved
ui/src/pages/frontsite/PatronProfile/PatronPendingLoans/PatronPendingLoans.js
Show resolved
Hide resolved
ui/src/pages/frontsite/PatronProfile/PatronPendingLoans/PatronPendingLoans.js
Show resolved
Hide resolved
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.
LGTM! :)
@@ -21,7 +21,7 @@ export class DocumentLinks extends Component { | |||
|
|||
hasPermissions = eitem => { | |||
if (!eitem.open_access) { | |||
return sessionManager.authenticated; | |||
return sessionManager.isAuthenticated(); |
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.
thanks for fixing this, I have no idea why it was working for me, I will check it
81f5c8b
to
b1b246b
Compare
- patron can cancel its own literature request - restored circulation in resolved document - rename onChangeDocument to onRemoveDocument - restructured document request endpoints - Document Request Reject need_record_permission - confirmation modal when patron cancels literature request - fix message for no literature requests - cast patron_pid as a string when we fetch it - refactored common helpers - document request custom endpoints permission test - rename the PendingRequestResource to be more explicit - fix OrderSubmitForm serializer from inveniosoftware#738 - closes inveniosoftware#742 add the circulation field in the loan resolver in loan.py:document_resolver(loan_pid) - closes inveniosoftware#743
- addressed review comments - implemented isAuthenticated for session manager, to replace the property authenticated which was never defined - fixed an issue with item link for loan when there is no item available
b1b246b
to
64a91ce
Compare