0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Fix revoke user invite and user.destroy

fixes #3630
- Extend user adapter in ember to load users with status: all
- Fix user.destroy by loading all users with status: all
This commit is contained in:
Fabian Becker 2014-08-06 16:48:18 +00:00
parent a65cc15e56
commit 9915fb1268
3 changed files with 8 additions and 2 deletions

View file

@ -32,6 +32,12 @@ var UserAdapter = EmbeddedRelationAdapter.extend({
// Use the url from the ApplicationAdapter's buildURL method
return this.ajax(url, 'PUT', { data: data });
},
find: function (store, type, id) {
var url = this.buildQuery(store, type, id);
url.status = 'all';
return this.findQuery(store, type, url);
}
});

View file

@ -282,7 +282,7 @@ users = {
*/
destroy: function destroy(options) {
return canThis(options.context).destroy.user(options.id).then(function () {
return users.read(options).then(function (result) {
return users.read(_.merge(options, { status: 'all'})).then(function (result) {
return dataProvider.Base.transaction(function (t) {
options.transacting = t;
dataProvider.Post.destroyByAuthor(options).then(function () {

View file

@ -513,7 +513,7 @@ User = ghostBookshelf.Model.extend({
// Grab the original args without the first one
origArgs = _.toArray(arguments).slice(1);
// Get the actual post model
return this.findOne({id: userModelOrId}).then(function (foundUserModel) {
return this.findOne({id: userModelOrId, status: 'all'}).then(function (foundUserModel) {
// Build up the original args but substitute with actual model
var newArgs = [foundUserModel].concat(origArgs);