Renamed email-preview file to email-previews

refs https://github.com/TryGhost/Toolbox/issues/308

- I recently pluralised the API endpoint but never made the changes to
  the controller file and everywhere else it's needed
- this commit cleans up that inconsistency so it should be clearer
This commit is contained in:
Daniel Lockyer 2022-04-25 18:38:46 +01:00
parent 1b108d2cdb
commit 68cffa62ae
No known key found for this signature in database
GPG Key ID: D21186F0B47295AD
6 changed files with 7 additions and 7 deletions

View File

@ -149,8 +149,8 @@ module.exports = {
return shared.pipeline(require('./actions'), localUtils);
},
get email_preview() {
return shared.pipeline(require('./email-preview'), localUtils);
get email_previews() {
return shared.pipeline(require('./email-previews'), localUtils);
},
get emails() {

View File

@ -288,8 +288,8 @@ module.exports = function apiRoutes() {
router.get('/actions', mw.authAdminApi, http(api.actions.browse));
// ## Email Preview
router.get('/email_previews/posts/:id', mw.authAdminApi, http(api.email_preview.read));
router.post('/email_previews/posts/:id', mw.authAdminApi, http(api.email_preview.sendTestEmail));
router.get('/email_previews/posts/:id', mw.authAdminApi, http(api.email_previews.read));
router.post('/email_previews/posts/:id', mw.authAdminApi, http(api.email_previews.sendTestEmail));
// ## Emails
router.get('/emails', mw.authAdminApi, http(api.emails.browse));

View File

@ -54,7 +54,7 @@ describe('Email Preview API', function () {
should.exist(jsonResponse);
should.exist(jsonResponse.email_previews);
localUtils.API.checkResponse(jsonResponse.email_previews[0], 'email_preview', null, null);
localUtils.API.checkResponse(jsonResponse.email_previews[0], 'email_previews', null, null);
});
it('can read post email preview with email card and replacements', async function () {

View File

@ -165,7 +165,7 @@ const expectedProperties = {
,
email: _(schema.emails)
.keys(),
email_preview: ['html', 'subject', 'plaintext'],
email_previews: ['html', 'subject', 'plaintext'],
email_recipient: _(schema.email_recipients)
.keys()
.filter(key => key.indexOf('@@') === -1),

View File

@ -185,7 +185,7 @@ const expectedProperties = {
'created_at',
'updated_at'
],
email_preview: ['html', 'subject', 'plaintext']
email_previews: ['html', 'subject', 'plaintext']
};
module.exports = {