ghost 4.46.0 → 4.46.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,35 +4,35 @@ const logging = require('@tryghost/logging');
4
4
  const startsWith = require('lodash/startsWith');
5
5
  const {createTransactionalMigration} = require('../../utils');
6
6
 
7
- // This uses the default settings from core/server/data/schema/default-settings/default-settings.json
8
- const newsletter = {
9
- id: (new ObjectId()).toHexString(),
10
- uuid: uuid.v4(),
11
- name: 'Ghost',
12
- description: '',
13
- slug: 'default-newsletter',
14
- sender_name: null,
15
- sender_email: null,
16
- sender_reply_to: 'newsletter',
17
- status: 'active',
18
- visibility: 'members',
19
- subscribe_on_signup: true,
20
- sort_order: 0,
21
- body_font_category: 'sans_serif',
22
- footer_content: '',
23
- header_image: null,
24
- show_badge: true,
25
- show_feature_image: true,
26
- show_header_icon: true,
27
- show_header_title: true,
28
- show_header_name: false,
29
- title_alignment: 'center',
30
- title_font_category: 'sans_serif',
31
- created_at: new Date()
32
- };
33
-
34
7
  module.exports = createTransactionalMigration(
35
8
  async function up(knex) {
9
+ // This uses the default settings from core/server/data/schema/default-settings/default-settings.json
10
+ const newsletter = {
11
+ id: (new ObjectId()).toHexString(),
12
+ uuid: uuid.v4(),
13
+ name: 'Ghost',
14
+ description: '',
15
+ slug: 'default-newsletter',
16
+ sender_name: null,
17
+ sender_email: null,
18
+ sender_reply_to: 'newsletter',
19
+ status: 'active',
20
+ visibility: 'members',
21
+ subscribe_on_signup: true,
22
+ sort_order: 0,
23
+ body_font_category: 'sans_serif',
24
+ footer_content: '',
25
+ header_image: null,
26
+ show_badge: true,
27
+ show_feature_image: true,
28
+ show_header_icon: true,
29
+ show_header_title: true,
30
+ show_header_name: false,
31
+ title_alignment: 'center',
32
+ title_font_category: 'sans_serif',
33
+ created_at: knex.raw('CURRENT_TIMESTAMP')
34
+ };
35
+
36
36
  // Make sure the newsletter table is empty
37
37
  const newsletters = await knex('newsletters').count('*', {as: 'total'});
38
38
 
@@ -68,6 +68,13 @@ module.exports = createTransactionalMigration(
68
68
  if (startsWith(key, 'newsletter_')) {
69
69
  key = key.slice(11);
70
70
  }
71
+
72
+ if (value === null && ['name', 'body_font_category', 'show_badge', 'show_feature_image', 'show_header_icon', 'show_header_title', 'title_alignment', 'title_font_category'].includes(key)) {
73
+ // Prevent setting null to non-nullable columns
74
+ // Default to defaults above in that case
75
+ continue;
76
+ }
77
+
71
78
  if (typeof newsletter[key] === 'boolean') {
72
79
  newsletter[key] = value === 'true';
73
80
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ghost",
3
- "version": "4.46.0",
3
+ "version": "4.46.1",
4
4
  "description": "The professional publishing platform",
5
5
  "author": "Ghost Foundation",
6
6
  "homepage": "https://ghost.org",