mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 17:04:59 +03:00
fix most recent post stolen by the last logged in user AND only show active users in post-settings-menu drop-down
fixes #3549 fixes #3528 - instead of grabbing and setting the author after fetching the list of users, get the author info from the models "author" property and set it when that value returns. (3549) - added filter to the PSM's "authors" attribute to only display active users (3528)
This commit is contained in:
parent
ec1dc0e24a
commit
44dd5ed286
@ -13,7 +13,13 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
|
|||||||
this.addObserver('titleScratch', this, 'titleObserver');
|
this.addObserver('titleScratch', this, 'titleObserver');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectedAuthor: Ember.computed.oneWay('author'),
|
selectedAuthor: Ember.computed(function () {
|
||||||
|
var self = this;
|
||||||
|
return this.get('author').then(function (author) {
|
||||||
|
self.set('selectedAuthor', author);
|
||||||
|
return author;
|
||||||
|
});
|
||||||
|
}),
|
||||||
changeAuthor: function () {
|
changeAuthor: function () {
|
||||||
var author = this.get('author'),
|
var author = this.get('author'),
|
||||||
selectedAuthor = this.get('selectedAuthor'),
|
selectedAuthor = this.get('selectedAuthor'),
|
||||||
@ -32,15 +38,14 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
|
|||||||
}.observes('selectedAuthor'),
|
}.observes('selectedAuthor'),
|
||||||
authors: function () {
|
authors: function () {
|
||||||
//Loaded asynchronously, so must use promise proxies.
|
//Loaded asynchronously, so must use promise proxies.
|
||||||
var deferred = {},
|
var deferred = {};
|
||||||
self = this;
|
|
||||||
|
|
||||||
deferred.promise = this.store.find('user').then(function (users) {
|
deferred.promise = this.store.find('user').then(function (users) {
|
||||||
return users.rejectBy('id', 'me');
|
return users.rejectBy('id', 'me');
|
||||||
}).then(function (users) {
|
}).then(function (users) {
|
||||||
self.set('selectedAuthor', users.get('firstObject'));
|
return users.filter(function (user) {
|
||||||
|
return user.get('active');
|
||||||
return users;
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return Ember.ArrayProxy
|
return Ember.ArrayProxy
|
||||||
@ -245,4 +250,4 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default PostSettingsMenuController;
|
export default PostSettingsMenuController;
|
||||||
|
Loading…
Reference in New Issue
Block a user