Added show_header_name column to newsletters table

refs https://github.com/TryGhost/Team/issues/1532

- Added before the migration in https://github.com/TryGhost/Ghost/pull/14468 to populate the default newsletter
- The fixture for the default newsletter has a different value than the model and schema default
- This is because by default the newsletter name is the same as the site title, and the site title is already shown
This commit is contained in:
Matt Hanley 2022-04-21 16:14:16 +01:00 committed by Matt Hanley
parent 65c2958f2a
commit 298599ce91
7 changed files with 41 additions and 15 deletions

View File

@ -0,0 +1,7 @@
const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('newsletters', 'show_header_name', {
type: 'boolean',
nullable: false,
defaultTo: true
});

View File

@ -24,7 +24,8 @@
"entries": [
{
"name": "Default Newsletter",
"slug": "default-newsletter"
"slug": "default-newsletter",
"show_header_name": false
}
]
},

View File

@ -33,7 +33,8 @@ module.exports = {
show_feature_image: {type: 'bool', nullable: false, defaultTo: true},
body_font_category: {type: 'string', maxlength: 191, nullable: false, defaultTo: 'sans_serif', validations: {isIn: [['serif', 'sans_serif']]}},
footer_content: {type: 'text', maxlength: 1000000000, nullable: true},
show_badge: {type: 'bool', nullable: false, defaultTo: true}
show_badge: {type: 'bool', nullable: false, defaultTo: true},
show_header_name: {type: 'bool', nullable: false, defaultTo: true}
},
posts: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},

View File

@ -15,7 +15,8 @@ const Newsletter = ghostBookshelf.Model.extend({
body_font_category: 'sans_serif',
show_badge: true,
show_header_icon: true,
show_header_title: true
show_header_title: true,
show_header_name: true
},
async onSaving(model, _attr, options) {

View File

@ -2034,6 +2034,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "weekly-newsletter",
"sort_order": 2,
@ -2060,7 +2061,7 @@ exports[`Members API: with multiple newsletters Can add and edit with custom new
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "1145",
"content-length": "1169",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
@ -2099,6 +2100,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "daily-newsletter",
"sort_order": 1,
@ -2125,7 +2127,7 @@ exports[`Members API: with multiple newsletters Can add and edit with custom new
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "1144",
"content-length": "1168",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",
@ -2163,6 +2165,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "default-newsletter",
"sort_order": 0,
@ -2185,6 +2188,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "weekly-newsletter",
"sort_order": 2,
@ -2211,7 +2215,7 @@ exports[`Members API: with multiple newsletters Can add with default newsletters
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "1626",
"content-length": "1674",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
@ -2459,7 +2463,7 @@ exports[`Members API: with multiple newsletters Can filter on newsletter slug 2:
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "1700",
"content-length": "1748",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",

View File

@ -16,6 +16,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "my-test-newsletter",
"sort_order": 0,
@ -33,7 +34,7 @@ exports[`Newsletters API Can add a newsletter 2: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "516",
"content-length": "540",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"location": Any<String>,
@ -68,6 +69,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "default-newsletter",
"sort_order": 0,
@ -90,6 +92,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "my-test-newsletter",
"sort_order": 0,
@ -112,6 +115,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "daily-newsletter",
"sort_order": 1,
@ -134,6 +138,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "weekly-newsletter",
"sort_order": 2,
@ -151,7 +156,7 @@ exports[`Newsletters API Can add a newsletter 4: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "2094",
"content-length": "2190",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",
@ -185,6 +190,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "default-newsletter",
"sort_order": 0,
@ -207,6 +213,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "my-test-newsletter",
"sort_order": 0,
@ -229,6 +236,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "daily-newsletter",
"sort_order": 1,
@ -251,6 +259,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "weekly-newsletter",
"sort_order": 2,
@ -268,7 +277,7 @@ exports[`Newsletters API Can browse newsletters 2: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "2094",
"content-length": "2190",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",
@ -302,6 +311,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "default-newsletter",
"sort_order": 0,
@ -319,7 +329,7 @@ exports[`Newsletters API Can edit newsletters 2: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "594",
"content-length": "618",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",
@ -343,6 +353,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "default-newsletter",
"sort_order": 0,
@ -360,7 +371,7 @@ exports[`Newsletters API Can edit newsletters 4: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "515",
"content-length": "539",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",
@ -384,6 +395,7 @@ Object {
"show_badge": true,
"show_feature_image": true,
"show_header_icon": true,
"show_header_name": true,
"show_header_title": true,
"slug": "daily-newsletter",
"sort_order": 1,
@ -401,7 +413,7 @@ exports[`Newsletters API Can read a newsletter 2: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "515",
"content-length": "539",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",

View File

@ -35,8 +35,8 @@ const validateRouteSettings = require('../../../../../core/server/services/route
*/
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = 'ae71340a8c89f6580b2eb06101f003b4';
const currentFixturesHash = '2fe576bcde3428c3063c05b2f2c37367';
const currentSchemaHash = 'd5f7d8ad423391e56da160e54358963b';
const currentFixturesHash = '4924616fbc51dd0ccef62ae04b4708f9';
const currentSettingsHash = 'ffd899a82b0ad2886e92d8244bcbca6a';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';