0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-15 03:01:37 -05:00

Added comment related fields to members table

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

- `last_commented_at` - to be used for filtering members list in Admin
- `bio` - short field used to show a "title" or similar context alongside name when commenting
- `enable_comment_notifications` - setting for turning on/off email notification of comment replies
This commit is contained in:
Kevin Ansfield 2022-07-05 12:42:31 +02:00 committed by Hannah Wolfe
parent a78eed1799
commit fa59286eff
5 changed files with 29 additions and 4 deletions

View file

@ -0,0 +1,21 @@
const {createAddColumnMigration, combineNonTransactionalMigrations} = require('../../utils');
module.exports = combineNonTransactionalMigrations(
createAddColumnMigration('members', 'last_commented_at', {
type: 'dateTime',
nullable: true
}),
createAddColumnMigration('members', 'bio', {
type: 'string',
nullable: true,
maxlength: 191,
validations: {isLength: {max: 50}}
}),
createAddColumnMigration('members', 'enable_comment_notifications', {
type: 'boolean',
nullable: false,
defaultTo: true
})
);

View file

@ -392,12 +392,15 @@ module.exports = {
}
},
name: {type: 'string', maxlength: 191, nullable: true},
bio: {type: 'string', maxlength: 191, nullable: true, validations: {isLength: {max: 50}}},
note: {type: 'string', maxlength: 2000, nullable: true},
geolocation: {type: 'string', maxlength: 2000, nullable: true},
enable_comment_notifications: {type: 'boolean', nullable: false, defaultTo: true},
email_count: {type: 'integer', unsigned: true, nullable: false, defaultTo: 0},
email_opened_count: {type: 'integer', unsigned: true, nullable: false, defaultTo: 0},
email_open_rate: {type: 'integer', unsigned: true, nullable: true, index: true},
last_seen_at: {type: 'dateTime',nullable: true},
last_seen_at: {type: 'dateTime', nullable: true},
last_commented_at: {type: 'dateTime', nullable: true},
created_at: {type: 'dateTime', nullable: false},
created_by: {type: 'string', maxlength: 24, nullable: false},
updated_at: {type: 'dateTime', nullable: true},

View file

@ -12,7 +12,8 @@ const Member = ghostBookshelf.Model.extend({
status: 'free',
uuid: uuid.v4(),
email_count: 0,
email_opened_count: 0
email_opened_count: 0,
enable_comment_notifications: true
};
},

View file

@ -3018,7 +3018,7 @@ exports[`Members API Can subscribe to a newsletter 5: [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": "4377",
"content-length": "4665",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",

View file

@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
*/
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = 'ca62bf36d1fdccbbbd951d9f7ecadcd7';
const currentSchemaHash = '89e2e6356edb2a3cd1c7a9962ef1fc88';
const currentFixturesHash = '1d6562a1963a9b9d10d06070d537f11f';
const currentSettingsHash = '0b138cdd40e48b5b7dc4ebac2a7819a7';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';