openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

Navigating to non-existent problem ID on client site should send 404 #11

Closed boonebgorges closed 7 years ago

boonebgorges commented 8 years ago

or something like that. It's probably not possible to send a 404 header after the React app has begun to load, but maybe we can do a rewrite or a redirect.

moui72 commented 8 years ago

Here's an example that is hanging: OL: http://openlabdev.org/webwork-playground/?post_data_key=webwork_post_data_8cfea9275b0f628b21d240d6aa45f609#/problem/

Generated by clicking "ask for help" from here: http://mathww.citytech.cuny.edu/webwork2/WW-Dev/AddRationalExpressions2/?key=JgtP3lHcqR9wv9lylHcAL5pMV6WnBsNg&effectiveUser=student2&user=student2

see also: https://openlab.citytech.cuny.edu/groups/openlab-webwork-integration-project/forum/topic/addressing-issues-on-webwork-side/

boonebgorges commented 8 years ago

Thanks for updating this, @moui72. There are really two different kinds of situations here:

  1. A user enters a nonsense URL: http://openlabdev.org/webwork-playground/#/problem/foo This will lead to a bunch of weird "null" stuff
  2. A user clicks Ask For Help from a space other than a specific question.

Your observation is about item 2. In this case, I don't think we should 404. Ideally, we'd route the user to a filtered view of all questions that is relevant to the context from which the user has just come in WW. S, when coming from the WW URL you shared above, we'd go to the question index, filtered by WW-Dev and AddRationalExpressions2. But this is more work than I can manage at the moment. So, as an interim fix, I've added logic that redirects users to the main question index when clicking Ask For Help in a non-problem context.

Does it seem like an improvement to you?

moui72 commented 8 years ago

@boonebgorges yeah, I think it's fine as is for now with regard to 2.

boonebgorges commented 7 years ago

I've added some logic that couses incorrect problem URLs to show a "not found" message instead of a blank problem form. Test this with a dummy URL like http://openlabdev.org/webwork-playground/#/problem/foo

moui72 commented 7 years ago

seems good.

boonebgorges commented 7 years ago

Thanks!