Skip to content

Commit f7db71a

Browse files
authored
Make preprint head tags show correct created/published dates (#2144)
## Purpose - Make sure preprint detail page head tags show correct date, and not show that all preprints were published today ## Summary of Changes - Use `Preprint.datePublished` instead of non-existent `Preprint.dateRegistered`
1 parent e0e40d6 commit f7db71a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

app/preprints/detail/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default class PreprintsDetail extends Route {
119119
const metaTagsData = {
120120
title: preprint.title,
121121
description: preprint.description,
122-
publishedDate: moment(preprint.dateRegistered).format('YYYY-MM-DD'),
122+
publishedDate: moment(preprint.datePublished).format('YYYY-MM-DD'),
123123
modifiedDate: moment(preprint.dateModified).format('YYYY-MM-DD'),
124124
identifier: preprint.id,
125125
url: pathJoin(config.OSF.url, preprint.id),

mirage/factories/preprint.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ export default Factory.extend<PreprintMirageModel & PreprintTraits>({
4848
isPreprintOrphan: false,
4949

5050
description: faker.lorem.sentence(),
51+
dateCreated: new Date('2018-05-05T14:49:27.746938Z'),
52+
dateModified: new Date('2018-07-02T11:51:07.837747Z'),
53+
datePublished: new Date('2018-05-05T14:54:01.681202Z'),
5154

5255
licenseRecord: {
5356
copyright_holders: [
@@ -137,9 +140,6 @@ export default Factory.extend<PreprintMirageModel & PreprintTraits>({
137140
subjects,
138141
files: [file],
139142
primaryFile: file,
140-
date_created: new Date('2018-05-05T14:49:27.746938Z'),
141-
date_modified: new Date('2018-07-02T11:51:07.837747Z'),
142-
date_published: new Date('2018-05-05T14:54:01.681202Z'),
143143
node,
144144
});
145145
},

mirage/scenarios/preprints.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ function buildOSF(
9292
id: 'osf-approved',
9393
title: 'Preprint RWF: Pre-moderation, Non-Admin and Approved',
9494
currentUserPermissions: [],
95+
datePublished: new Date('2016-12-25T16:00:00.000000Z'),
96+
dateModified: new Date('2016-12-31T16:00:00.000000Z'),
9597
doi: '10.30822/artk.v1i1.79',
9698
reviewsState: ReviewsState.ACCEPTED,
9799
description: `${faker.lorem.sentence(200)}\n${faker.lorem.sentence(300)}`,

0 commit comments

Comments
 (0)