Page MenuHomePhabricator

[e.cash] Sort blogs by publish date
ClosedPublic

Authored by johnkuney on Dec 19 2023, 06:07.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC709838a735f4: [e.cash] Sort blogs by publish date
Summary

It was requested to have the ability to back date blog posts. Currently they are grabbed from strapi
and returned in order by the publishedAt field.

This field is generated by strapi based on when the post was published and afaik theres not an easy way to edit it after the fact

So if we want to say copy and older post from somewhere else, its publish date will be the day its copied and published,
and it will appear later than its actual publish date.

I actually already setup an alternative date field for this reason when migrating the blog. All of the legacy posts needed
to maintain their original publish dates so I added the publish_date field that can be added by any author. This takes
precedent over the publishedAt field. So all legacy posts actually have the same day publishedAt value, each one is just a few seconds
older than the next as they were uploaded.

Long way to explain, Im adding a sort function to the blog getter based on either publishedAt or publish_date. This way we
can manually input an older publish_date for a given post in the strapi UI and it should appear in the correct place

Test Plan

preview the site and check /blog. Scroll down to July 2023 posts and you should see the back dated 'How to Run CashFusion Remotely' in the
proper place

Then if you preview master it would appear at the top

tests should still pass as well

Diff Detail

Repository
rABC Bitcoin ABC
Branch
ecash-order-blog-by-date
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25992
Build 51558: Build Diff
Build 51557: arc lint + arc unit

Event Timeline

johnkuney edited the summary of this revision. (Show Details)
Fabien requested changes to this revision.Dec 19 2023, 08:19
Fabien added a subscriber: Fabien.
Fabien added inline comments.
web/e.cash/pages/blog.js
107 ↗(On Diff #43659)

Why do you need the sort here ? AFAICT the only place it matters is when displaying the blog page.

web/e.cash/pages/blog/[slug].js
111 ↗(On Diff #43659)

Same question

127 ↗(On Diff #43659)

dito

This revision now requires changes to proceed.Dec 19 2023, 08:19
johnkuney edited the test plan for this revision. (Show Details)

dont use the sort function uneccesarially

Yes good call, no need to use it on the [slug] pages

This revision is now accepted and ready to land.Dec 19 2023, 20:57
This revision was automatically updated to reflect the committed changes.