mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 13:22:39 +03:00
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:
parent
5ba3f5efcf
commit
75170535a4
@ -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 {string} unfilteredOptions.id
|
||||
* @param {Object} unfilteredOptions.context
|
||||
* @param {Object} unfilteredOptions.transacting
|
||||
*/
|
||||
destroyByAuthor: async function destroyByAuthor(unfilteredOptions) {
|
||||
let options = this.filterOptions(unfilteredOptions, 'destroyByAuthor', {extraAllowedProperties: ['id']});
|
||||
reassignByAuthor: async function reassignByAuthor(unfilteredOptions) {
|
||||
let options = this.filterOptions(unfilteredOptions, 'reassignByAuthor', {extraAllowedProperties: ['id']});
|
||||
let authorId = options.id;
|
||||
|
||||
if (!authorId) {
|
||||
|
@ -11,7 +11,7 @@ const path = require('path');
|
||||
* @prop {Object} Base
|
||||
* @prop {(callback: function) => Promise} Base.transaction
|
||||
* @prop {Object} Post
|
||||
* @prop {(frameOptions: Object) => Promise} Post.destroyByAuthor
|
||||
* @prop {(frameOptions: Object) => Promise} Post.reassignByAuthor
|
||||
* @prop {Object} ApiKey
|
||||
* @prop {(Object) => Promise} ApiKey.destroy
|
||||
* @prop {Object} ApiKey.NotFoundError
|
||||
@ -76,7 +76,7 @@ class Users {
|
||||
return this.models.Base.transaction(async (t) => {
|
||||
frameOptions.transacting = t;
|
||||
|
||||
await this.models.Post.destroyByAuthor(frameOptions);
|
||||
await this.models.Post.reassignByAuthor(frameOptions);
|
||||
|
||||
try {
|
||||
await this.models.ApiKey.destroy({
|
||||
|
Loading…
Reference in New Issue
Block a user