freelawproject / courtlistener

A fully-searchable and accessible archive of court data including growing repositories of opinions, oral arguments, judges, judicial financial records, and federal filings.
https://www.courtlistener.com
Other
550 stars 151 forks source link

Get Alerts Button Bug #4581

Closed Carter4242 closed 1 month ago

Carter4242 commented 1 month ago

When pressing the Get Alerts button on any case while logged in causes a weird error. "Not an ajax POST request." Image

However, pressing the dropdown on Get Alerts -> Share Alert Link (E.g. taking you here as an example). Pressing Get Alerts on that page works just fine...

Looking in my Network tab, it appears that it is indeed not an Ajax POST request... When on the Share Alert screen, it sends a POST request, and when on the main opinion screen, a GET request is sent instead.

I've searched through the code base for a like 20 minutes now, and I can't find out why that is (I know very little about Ajax though...) It may be a bug on my end, but I tried it in 2 different browsers.

Both buttons appear to be created by https://github.com/freelawproject/courtlistener/blob/710ff4b3fe71bca4cd329544423d497e2ddc968a/cl/opinion_page/templates/includes/docket_alerts_button.html

Which calls https://github.com/freelawproject/courtlistener/blob/710ff4b3fe71bca4cd329544423d497e2ddc968a/cl/alerts/views.py#L201 However, one calls with GET, and one with POST, when requested with GET it leads to this line https://github.com/freelawproject/courtlistener/blob/710ff4b3fe71bca4cd329544423d497e2ddc968a/cl/alerts/views.py#L237 Which returns the response I'm getting.

Apologies if this has already been reported, or is an issue on my end.

mlissner commented 1 month ago

I'm seeing this too, so something is up. My guess is that it's being caused by https://github.com/freelawproject/courtlistener/pull/4519, which I just reverted in https://github.com/freelawproject/courtlistener/pull/4582. It's deploying now. We'll know in about 15 minutes if this fixes it.

mlissner commented 1 month ago

OK, that worked. We'll get this fixed and re-deploy the earlier PR. Thanks for the detailed report!