0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Added primary_name context for added events

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

- we should store the `primary_name` on `added` events too because if
  the resource is eventually deleted, we won't have the pretty name to
  refer to it
This commit is contained in:
Daniel Lockyer 2022-08-24 08:51:03 +02:00
parent c860b5b715
commit 76406f78bb
No known key found for this signature in database
GPG key ID: D21186F0B47295AD

View file

@ -39,7 +39,7 @@ module.exports = function (Bookshelf) {
if (event === 'deleted') {
context.primary_name = (this.previous('title') || this.previous('name'));
} else if (event === 'edited') {
} else if (['added', 'edited'].includes(event)) {
context.primary_name = (this.get('title') || this.get('name') || this.previous('title') || this.previous('name'));
}