-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Alert patron on lending error #8501
Alert patron on lending error #8501
Conversation
def prepare_json_response(self, status_code, data=None): | ||
d = json.dumps(data or {}) | ||
return web.HTTPError( | ||
status_code, | ||
headers = { | ||
"Content-Type": "application/json", | ||
}, | ||
data=d | ||
) |
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.
An improved version of this function would be useful throughout the codebase.
I think there's a lot here that's in the right direction, my main reservation is having the borrow process itself require js -- my preference would be that we attempt a borrow and if it fails, we return the patron to the book page with a |
98e24a2
to
1c4fba7
Compare
for more information, see https://pre-commit.ci
@@ -189,6 +190,12 @@ def POST(self, key): | |||
except lending.PatronAccessException as e: | |||
stats.increment('ol.loans.blocked') | |||
|
|||
add_flash_message( | |||
'error', | |||
_('Unable to complete borrow action. Please try again later.'), |
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.
@mekarpeles you'll probably want to update this copy. I think that you suggested something specific last week, but I was unable to find the suggestion.
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.
@bfalling your input required
LGTM, simple! |
Closes #8372
Displays a toast message when clicking a "Borrow" or "Read" button results in a
404
or409
from the server. Otherwise, redirects to the location returned by the server. Ajson
handler forocaid
checkouts has been added in support of this feature.Technical
The borrow logic was moved into its own method, which, instead of raising exceptions, instead returns a two-tuple containing the HTTP status code and optional redirect location. This method is called by both the original
ocaid
checkout handler, and the newjson
handler.Testing
Screenshot
Stakeholders