mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-15 03:01:37 -05:00
Removed unnecessary email_preview.read serializer
refs: https://github.com/TryGhost/Toolbox/issues/245 refs: https://github.com/TryGhost/Ghost/commit/73f91a524 - we don't need this serializer because the default serializer will do the same thing - commit 73f91a524 fixes the logic so that the default serializer is called as a fallback even though the email_preview serialzier exists, as there's no matching method name - sadly the route name here is wrong, it should be email_previews plural, but the response format is correct to make this work we have to fix the docName and rename the serializer
This commit is contained in:
parent
22b6f1af99
commit
470ed05620
5 changed files with 12 additions and 13 deletions
|
@ -12,7 +12,8 @@ const emailPreview = new mega.EmailPreview({
|
|||
});
|
||||
|
||||
module.exports = {
|
||||
docName: 'email_preview',
|
||||
// @TODO make the route match the resource name in 5.0
|
||||
docName: 'email_previews',
|
||||
|
||||
read: {
|
||||
options: [
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
module.exports = {
|
||||
read(emailPreview, apiConfig, frame) {
|
||||
frame.response = {
|
||||
email_previews: [emailPreview]
|
||||
};
|
||||
},
|
||||
sendTestEmail(data, apiConfig, frame) {
|
||||
frame.response = data;
|
||||
}
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
// @TODO remove for 5.0
|
||||
// This should be a default serializer, not a passthrough, as per the read endpoint
|
||||
sendTestEmail(data, apiConfig, frame) {
|
||||
frame.response = data;
|
||||
}
|
||||
};
|
|
@ -109,8 +109,8 @@ module.exports = {
|
|||
return require('./site');
|
||||
},
|
||||
|
||||
get email_preview() {
|
||||
return require('./email-preview');
|
||||
get email_previews() {
|
||||
return require('./email-previews');
|
||||
},
|
||||
|
||||
get snippets() {
|
||||
|
|
|
@ -290,6 +290,7 @@ module.exports = function apiRoutes() {
|
|||
router.get('/actions', mw.authAdminApi, http(api.actions.browse));
|
||||
|
||||
// ## Email Preview
|
||||
// @TODO: rename to email_previews in 5.0
|
||||
router.get('/email_preview/posts/:id', mw.authAdminApi, http(api.email_preview.read));
|
||||
router.post('/email_preview/posts/:id', mw.authAdminApi, http(api.email_preview.sendTestEmail));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue