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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions adminSiteClient/GdocsDateline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const GdocsDateline = ({
const onChangePublishedAt = (publishedAt: Dayjs | null) => {
setCurrentGdoc({
...gdoc,
publishedAt: publishedAt?.utc(true).toDate() || null,
publishedAt: publishedAt?.toDate() || null,
})
}

Expand All @@ -45,12 +45,16 @@ export const GdocsDateline = ({
<label htmlFor="publishedAt">Publication date</label>
<DatePicker
onChange={onChangePublishedAt}
value={
publishedAt ? dayjs(publishedAt).local() : undefined
}
value={publishedAt ? dayjs(publishedAt) : undefined}
format="ddd, MMM D, YYYY"
id="publishedAt"
status={publishedAtError?.type}
// The "Today" button has been disabled because it sets
// the time to the current time. This time change makes
// it all the way to the atom feed, which is then
// interpreted by MailChimp's RSS-to-Email as a new
// article.
showToday={false}
/>
<GdocsErrorHelp
error={publishedAtError}
Expand Down
3 changes: 2 additions & 1 deletion adminSiteClient/GdocsPublicationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ export const GdocsPublicationContext = ({
<>
<Row>
<Col>
<label htmlFor="publishedAt" className="mr-3">
<label htmlFor="publicationContext" className="mr-3">
Publication context
</label>
<Radio.Group
onChange={onChange}
value={publicationContext}
optionType="button"
id="publicationContext"
>
<Radio value={OwidGdocPublicationContext.unlisted}>
{OwidGdocPublicationContext.unlisted}
Expand Down
Loading