news-catalyst / next-tinynewsdemo

Frontend for Tiny News Collective organizations
https://next-tinynewsdemo.vercel.app
1 stars 0 forks source link

fix for newsletter archive page #1286

Closed pdeharo333 closed 2 years ago

pdeharo333 commented 2 years ago

Context of the issue: It has been noted by several folks that their scheduled/in review newsletter has been published to the archive newsletter page after a redeployment. This is happening because the script of 'build-newsletter-edition' on line 96 is pulling any newsletter with a date attached (even a future date) and saving it to Hasura. Then when vercel is redeployed it thinks that the newsletter saved in Hasura is published, and adds it to the archive page. In Hasura you can see newsletters that are scheduled but not published saved. The exemption are newsletters in draft (I believe because there is not date attached to it unlike when you schedule one).

Using unit testing and replacing the if statement on line 96 to use the 'newsletter.publicationStatus' variable I was able to see console.log that were saving newsletters not published. This is all based on the console logs

for reference: Publication status of results to include (1 = published; 2 = scheduled; 4 = review; 6 = all statuses)

My testing included running the original code with the date with this condition: (!newsletter.publicationDate) I noted that the console logs were saving newsletters in Hasura that were 2: scheduled or 4: in review.

After updating the code with the condition the logs are displaying that they are not saving in Hasura unless they are '1: published.' There may need to be an additional test to see how they are actually saving in Hasura since this is based on logs but I also think maybe we could push to staging as a test?

image

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
staging-tiny-news-sites ✅ Ready (Inspect) Visit Preview Sep 29, 2022 at 6:23PM (UTC)
9 Ignored Deployments | Name | Status | Preview | Updated | | :--- | :----- | :------ | :------ | | **ang-diaryo** | ⬜️ Ignored ([Inspect](https://vercel.com/news-catalyst/ang-diaryo/GAeWhqnH3eFZe4Xzw6tgAjgxPjWp)) | | Sep 29, 2022 at 6:23PM (UTC) | | **austin-vida** | ⬜️ Ignored ([Inspect](https://vercel.com/news-catalyst/austin-vida/6susWSq1PvXBSaTQzq9k4ZDvq7n6)) | | Sep 29, 2022 at 6:23PM (UTC) | | **black-by-god** | ⬜️ Ignored ([Inspect](https://vercel.com/news-catalyst/black-by-god/BzgKQZa45pHzy6WD9GT1o8DXiNKj)) | | Sep 29, 2022 at 6:23PM (UTC) | | **five-wards-media** | ⬜️ Ignored ([Inspect](https://vercel.com/news-catalyst/five-wards-media/64aGET81NaEcdjyoY64QMy3eDwys)) | | Sep 29, 2022 at 6:23PM (UTC) | | **harvey-world-herald** | ⬜️ Ignored ([Inspect](https://vercel.com/news-catalyst/harvey-world-herald/DBP1Awh7faed5yKVJVJtT8bmAzhi)) | | Sep 29, 2022 at 6:23PM (UTC) | | **next-tinynewsdemo** | ⬜️ Ignored ([Inspect](https://vercel.com/news-catalyst/next-tinynewsdemo/5KCBt8mtTDqWbjuzHyHM88J6ySo2)) | | Sep 29, 2022 at 6:23PM (UTC) | | **spotlight-schools** | ⬜️ Ignored ([Inspect](https://vercel.com/news-catalyst/spotlight-schools/7mcwTk7TLQ5MhsNaySZV2BQBaXBm)) | | Sep 29, 2022 at 6:23PM (UTC) | | **tiny-news-curriculum** | ⬜️ Ignored ([Inspect](https://vercel.com/news-catalyst/tiny-news-curriculum/CUx1Vw3HXwoz4CajWYtu95p8LibL)) | | Sep 29, 2022 at 6:23PM (UTC) | | **tiny-news-sites** | ⬜️ Ignored ([Inspect](https://vercel.com/news-catalyst/tiny-news-sites/J438Z4JyCqcbanxxRNcFy87LsamM)) | | Sep 29, 2022 at 6:23PM (UTC) |
cypress[bot] commented 2 years ago



Test summary

28 0 0 0


Run details

Project TNC Front-End
Status Passed
Commit c9239db7b2 ℹ️
Started Sep 29, 2022 6:13 PM
Ended Sep 29, 2022 6:18 PM
Duration 04:30 💡
OS Linux Ubuntu - 20.04
Browser Firefox 104

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

pdeharo333 commented 2 years ago

Thanks for the feedback. I checked in the changes into staging and confirmed it worked. Only published newsletters are being saved in Hasura and posted to archive page. I created newsletters in 'draft' 'scheduled' 'review' and 'published' and also checked in Hasura. If you'd like, you can run an additional test but otherwise it should be good for prod.