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