FIX: Restrict editing queued posts to one at a time

This commit is contained in:
Robin Ward 2015-04-16 15:50:47 -04:00
parent c7d367996a
commit e83bf7dc07
1 changed files with 5 additions and 4 deletions

View File

@ -13,27 +13,28 @@ function updateState(state) {
export default Ember.Controller.extend(BufferedContent, {
needs: ['queued-posts'],
post: Ember.computed.alias('model'),
currentlyEditing: Ember.computed.alias('controllers.queued-posts.editing'),
editing: false,
editing: Discourse.computed.propertyEqual('model', 'currentlyEditing'),
actions: {
approve: updateState('approved'),
reject: updateState('rejected'),
edit() {
this.set('editing', true);
this.set('currentlyEditing', this.get('model'));
},
confirmEdit() {
this.get('post').update({ raw: this.get('buffered.raw') }).then(() => {
this.commitBuffer();
this.set('editing', false);
this.set('currentlyEditing', null);
});
},
cancelEdit() {
this.rollbackBuffer();
this.set('editing', false);
this.set('currentlyEditing', null);
}
}
});