Renamed destroyByAuthor to reassignByAuthor

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

 - The previous naming didn't make much sense in the context of what the method what doing
This commit is contained in:
Naz 2022-04-26 16:31:24 +08:00 committed by Daniel Lockyer
parent 5ba3f5efcf
commit 75170535a4
No known key found for this signature in database
GPG Key ID: D21186F0B47295AD
2 changed files with 5 additions and 5 deletions

View File

@ -294,14 +294,14 @@ module.exports.extendModel = function extendModel(Post, Posts, ghostBookshelf) {
} }
}, { }, {
/** /**
* ### destroyByAuthor * ### reassignByAuthor
* @param {Object} unfilteredOptions has context and id. Context is the user doing the destroy, id is the user to destroy * @param {Object} unfilteredOptions has context and id. Context is the user doing the destroy, id is the user to destroy
* @param {string} unfilteredOptions.id * @param {string} unfilteredOptions.id
* @param {Object} unfilteredOptions.context * @param {Object} unfilteredOptions.context
* @param {Object} unfilteredOptions.transacting * @param {Object} unfilteredOptions.transacting
*/ */
destroyByAuthor: async function destroyByAuthor(unfilteredOptions) { reassignByAuthor: async function reassignByAuthor(unfilteredOptions) {
let options = this.filterOptions(unfilteredOptions, 'destroyByAuthor', {extraAllowedProperties: ['id']}); let options = this.filterOptions(unfilteredOptions, 'reassignByAuthor', {extraAllowedProperties: ['id']});
let authorId = options.id; let authorId = options.id;
if (!authorId) { if (!authorId) {

View File

@ -11,7 +11,7 @@ const path = require('path');
* @prop {Object} Base * @prop {Object} Base
* @prop {(callback: function) => Promise} Base.transaction * @prop {(callback: function) => Promise} Base.transaction
* @prop {Object} Post * @prop {Object} Post
* @prop {(frameOptions: Object) => Promise} Post.destroyByAuthor * @prop {(frameOptions: Object) => Promise} Post.reassignByAuthor
* @prop {Object} ApiKey * @prop {Object} ApiKey
* @prop {(Object) => Promise} ApiKey.destroy * @prop {(Object) => Promise} ApiKey.destroy
* @prop {Object} ApiKey.NotFoundError * @prop {Object} ApiKey.NotFoundError
@ -76,7 +76,7 @@ class Users {
return this.models.Base.transaction(async (t) => { return this.models.Base.transaction(async (t) => {
frameOptions.transacting = t; frameOptions.transacting = t;
await this.models.Post.destroyByAuthor(frameOptions); await this.models.Post.reassignByAuthor(frameOptions);
try { try {
await this.models.ApiKey.destroy({ await this.models.ApiKey.destroy({