WikiEducationFoundation / WikiEduDashboard

Wiki Education Foundation's Wikipedia course dashboard system
https://dashboard.wikiedu.org
MIT License
392 stars 630 forks source link

ArticleViewer does not handle redirects well #4171

Closed ragesoss closed 3 years ago

ragesoss commented 4 years ago

What is happening?

If the article viewed in ArticleViewer is a redirect, authorship highlighting does not work. The error message says to try again, but this will not help.

To Reproduce

Here's an example: https://dashboard.wikiedu.org/courses/Northeastern_University/ENGW_3306_(Spring_2020)/articles/edited?showArticle=52116875

Expected behavior

A clear message should be shown to explain that authorship highlighting is no available for redirect pages, and the page history on Wikipedia can be used instead.

rohitgeddam commented 3 years ago

Is this bug fixed by #4168, If not I would like to work on this!

ragesoss commented 3 years ago

No, it's not fixed. Go for it.

rohitgeddam commented 3 years ago

No, it's not fixed. Go for it.

sure, let's see how we can fix this.

rohitgeddam commented 3 years ago
Screenshot 2021-03-06 at 12 11 01 AM

Hey, I was trying to reproduce this error on my local system, I had created a test article which is a redirect, for example, https://en.wikipedia.org/wiki/UK redirects to https://en.wikipedia.org/wiki/United_Kingdom, However when I view this article in ArticleViewer, I don't see any errors. Am I missing something?

ragesoss commented 3 years ago

Interesting. It looks like the behavior of the WikiWho API has changed recently, and at least some redirects work fine now.

I note that the example I linked to, "Medical use of MDMA", still results in an error, although it's different than it was previously. It looks like now that particular redirect results in this response from the wikiwho server:

{"info":"Requested revision (947629440) is detected as vandalism by WikiWho.","success":false,"rev_id":947629440,"page_title":"Medical use of MDMA"}

I think the right solution here is probably to add handling for when WikiWho responds with a 200 but with success: false, such as by displaying the info returned by WikiWho.

rohitgeddam commented 3 years ago

Interesting. It looks like the behavior of the WikiWho API has changed recently, and at least some redirects work fine now.

I note that the example I linked to, "Medical use of MDMA", still results in an error, although it's different than it was previously. It looks like now that particular redirect results in this response from the wikiwho server:

{"info":"Requested revision (947629440) is detected as vandalism by WikiWho.","success":false,"rev_id":947629440,"page_title":"Medical use of MDMA"}

I think the right solution here is probably to add handling for when WikiWho responds with a 200 but with success: false, such as by displaying the info returned by WikiWho.

Screenshot 2021-03-06 at 1 18 18 AM

If we reach past line number 104, doesn't that mean that the response status is already 200, so we only need to check if, success: false, and display error with the text in { info : " ... " }. right?

ragesoss commented 3 years ago

Hmm... Looks like we do need to keep trying, because in some cases (as noted in the comment) a 200 with success: false happens because the wikiwho server hasn't finished processing that revision, but will do so soon. I think what we want to do, perhaps, is to update the error message after 5 attempts so that also includes whatever the last info received from the WikiWho server is, and remove the 'please try again' part.