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

Merge pull request #3569 from morficus/issue-3549

fix most recent post stolen by the last logged in user AND only show active users in post-settings-menu drop-down
This commit is contained in:
Sebastian Gierlinger 2014-08-04 10:51:07 +02:00
commit 89389b3673

View file

@ -13,7 +13,13 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
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 () {
var author = this.get('author'),
selectedAuthor = this.get('selectedAuthor'),
@ -38,15 +44,14 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
}.observes('selectedAuthor'),
authors: function () {
//Loaded asynchronously, so must use promise proxies.
var deferred = {},
self = this;
var deferred = {};
deferred.promise = this.store.find('user').then(function (users) {
return users.rejectBy('id', 'me');
}).then(function (users) {
self.set('selectedAuthor', users.get('firstObject'));
return users;
return users.filter(function (user) {
return user.get('active');
});
});
return Ember.ArrayProxy
@ -249,4 +254,4 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
}
});
export default PostSettingsMenuController;
export default PostSettingsMenuController;