thegazelle-ad / gazelle-server

Server for front-end and editor tools of The Gazelle
MIT License
19 stars 8 forks source link

News and opinion pages broken #497

Open J16053 opened 5 years ago

J16053 commented 5 years ago

Expected Behavior

Visiting these pages should not show a blank page. Where are the articles?

Current Behavior

Visiting these pages shows a blank page.

Possible Solution

A quick look leads me to believe that there might be a problem with one of the issues in each of those categories in the database, making the Falcor fetch fail and preventing the page from being displayed. To start, I would suggest sourcing the database dump for 2019-03-28, running The Gazelle locally, and tracing through the console errors to see if a database error can be found.

Maybe this bug will be less visible once enough new articles have been added to push the buggy article off the list of articles fetched, but it'd be best if we can figure out what's going on ASAP because if the problem is with an article it's sure to have affected other pages and links.

Steps to Reproduce (for bugs)

https://www.thegazelle.org/category/news https://www.thegazelle.org/category/opinion

J16053 commented 5 years ago

No longer a problem for this week's issue: would still be good to check out what was happening last week though

nurpeiis commented 5 years ago

The problem is not with articles from issue 155, it is with News category article of previous publications, simple "solution" would be putting articles length to be 8 in CategoryController.jsx, since the problem is with 9th article

J16053 commented 5 years ago

Thanks for looking into this! Changing the articles length would just be a band-aid solution: if the problematic article ever showed up anywhere else, it would likely still cause errors. Could you maybe find the name/slug/id of the 9th article so we can take a closer look at what's wrong and fix the problem at its root? Same goes for the problematic article in the opinion category that showed up that week.

nurpeiis commented 5 years ago
Screen Shot 2019-04-10 at 11 14 12 AM

I unpublished 3 articles, one of them is problematic, as when I unpublished 3 of them at the same time page started working. Now I am planning to publish each article one by one to see which one is problematic. Do you know how to publish back unpublished articles or do we have to create a new article? If it is creating new article, then we can have one new feature for admin page: have a button that will enable us to publish back unpublished articles

J16053 commented 5 years ago

An article can be published by adding it to a published issue, although playing with this myself just now I realized there are aspects of it that are kind of buggy. If you go to the Issues tab, select the issue you would like to have the article published in, select Articles, and then add the unpublished article to main articles, it should show up again. Make sure to remove an article from the issue it was published in before unpublishing it though.

nurpeiis commented 5 years ago

I have noticed that the article in News section that had issue ("Intense Basketball Game...") was without any tags. I believe that might be a reason of why article has "undefined" value

J16053 commented 5 years ago

Was that the article that was breaking the page? I don't think an article without tags would cause this since articles don't need to have tags to be published, but it is a possibility. I would suggest trying to trace the falcor call in CategoryController.jsx (hint: first step would be to look in lib/falcor/routes/categories/by-slug.js) to see what exactly is being fetched, then checking the database in that place to see why the query returns undefined.

navyasuri commented 5 years ago

Update - this problem just resurfaced (don't know if it went away for an issue/multiple issues in between though)

navyasuri commented 5 years ago

My bad, I just checked real quick and this is broken for ALL issues

J16053 commented 5 years ago

As discussed with @navyasuri , there appears to be a bigger underlying issue that deals with inconsistencies when creating/editing an article/issue that results in articles not having entries in the issues_articles_order table. Perhaps there's some edge case in the updateIssueArticles() function in db.js that fails to re-add entries to the table once they've been removed? I'll try and make a quick temporary fix today that gets the pages working again, but this is definitely something we'll have to look into more deeply.