Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gdoc): unstable publication time triggers duplicate Mailchimp newsletter #2698

Merged
merged 3 commits into from
Oct 5, 2023

Conversation

mlbrgl
Copy link
Member

@mlbrgl mlbrgl commented Oct 4, 2023

Interacting with the gdocs date picker changes the underlying time, in addition to the visible date. This change makes it all the way to the atom feed, which is then interpreted by Mailchimp RSS-to-Email feature as a new article to be sent.

This happens in two instances.

  1. Interacting with the date picker calendar, e.g. going from Oct 11, to Oct 10 and back to Oct 11:
publishedAt Wed Oct 11 2023 00:59:53 GMT+0100 (British Summer Time)
publishedAt Tue Oct 10 2023 01:59:53 GMT+0100 (British Summer Time)
publishedAt Wed Oct 11 2023 02:59:53 GMT+0100 (British Summer Time)

Notice how that third time is now 02:59:53 vs 00:59:53 originally.

  1. Pressing the "Today" button sets the time to the current time

image.png

This PR fixes 1 and removes the "Today" button so that the time remains unchanged from the first publishing event.

see slack

@mlbrgl
Copy link
Member Author

mlbrgl commented Oct 4, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@mlbrgl mlbrgl marked this pull request as ready for review October 4, 2023 08:21
@mlbrgl mlbrgl requested a review from ikesau October 4, 2023 08:21
Copy link
Member

@ikesau ikesau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I noticed this too when investigating the scheduled post thing. Thanks for fixing it.

I wonder if it would be better to just change the column to DATE though. updatedAt is still useful to have a timestamp, but it's not like the time an author pressed the publish button is used anywhere / relevant for in citations.

import { MigrationInterface, QueryRunner } from "typeorm"

export class ConvertPostGdocsDatetimetoDate1696422487206
    implements MigrationInterface
{
    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(
            `ALTER TABLE posts_gdocs MODIFY publishedAt DATE`
        )
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(
            // All the times will be 00:00:00
            `ALTER TABLE posts_gdocs MODIFY publishedAt DATETIME`
        )
    }
}

@mlbrgl
Copy link
Member Author

mlbrgl commented Oct 4, 2023

@ikesau good point, you're right, we don't really have a use for the published time on the frontend.

Having this information around has been useful for debugging, though, so I'd be tempted to keep it around if all else is equal.

Copy link
Member

@ikesau ikesau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay 🙂

@mlbrgl
Copy link
Member Author

mlbrgl commented Oct 5, 2023

Tangentially related: I'm adding a discussion point to our next P&D meeting regarding dateline (in frontmatter) vs publication date in the admin.

@mlbrgl mlbrgl merged commit 2fc92a6 into master Oct 5, 2023
20 checks passed
@mlbrgl mlbrgl deleted the fix-publication-date branch October 5, 2023 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants