1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-22 14:49:42 +02:00

Revision history will respect doc lifecycle stage

Protected documents cannot be rolled back!
This commit is contained in:
Harvey Kandola 2018-11-21 11:52:33 +00:00
parent c152d029f2
commit d499888cfd
2 changed files with 31 additions and 22 deletions

View file

@ -11,12 +11,13 @@
import { computed, set } from '@ember/object';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import ModalMixin from '../../mixins/modal';
import Component from '@ember/component';
export default Component.extend(ModalMixin, {
documentService: service('document'),
revision: null,
revisions: null,
diff: '',
hasRevisions: computed('revisions', function() {
return this.get('revisions').length > 0;
@ -24,6 +25,14 @@ export default Component.extend(ModalMixin, {
hasDiff: computed('diff', function() {
return this.get('diff').length > 0;
}),
canRollback: computed('permissions.documentEdit', 'document.protection', function() {
let constants = this.get('constants');
if (this.get('document.protection') === constants.ProtectionType.Lock) return false;
return this.get('permissions.documentEdit') &&
this.get('document.protection') === constants.ProtectionType.None;
}),
init() {
this._super(...arguments);