Merge "Hide "private" check box if private changes are disabled"
This commit is contained in:
@@ -55,7 +55,7 @@ limitations under the License.
|
|||||||
padding: 0 .15em;
|
padding: 0 .15em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.hideBranch {
|
.hide {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -108,7 +108,7 @@ limitations under the License.
|
|||||||
</iron-autogrow-textarea>
|
</iron-autogrow-textarea>
|
||||||
</span>
|
</span>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section class$="[[_computePrivateSectionClass(_privateChangesEnabled)]]">
|
||||||
<label
|
<label
|
||||||
class="title"
|
class="title"
|
||||||
for="privateChangeCheckBox">Private change</label>
|
for="privateChangeCheckBox">Private change</label>
|
||||||
|
@@ -44,6 +44,7 @@
|
|||||||
notify: true,
|
notify: true,
|
||||||
value: false,
|
value: false,
|
||||||
},
|
},
|
||||||
|
_privateChangesEnabled: Boolean,
|
||||||
},
|
},
|
||||||
|
|
||||||
behaviors: [
|
behaviors: [
|
||||||
@@ -52,10 +53,23 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
attached() {
|
attached() {
|
||||||
if (!this.repoName) { return; }
|
if (!this.repoName) { return Promise.resolve(); }
|
||||||
this.$.restAPI.getProjectConfig(this.repoName).then(config => {
|
|
||||||
this.privateByDefault = config.private_by_default;
|
const promises = [];
|
||||||
});
|
|
||||||
|
promises.push(this.$.restAPI.getProjectConfig(this.repoName)
|
||||||
|
.then(config => {
|
||||||
|
this.privateByDefault = config.private_by_default;
|
||||||
|
}));
|
||||||
|
|
||||||
|
promises.push(this.$.restAPI.getConfig().then(config => {
|
||||||
|
if (!config) { return; }
|
||||||
|
|
||||||
|
this._privateConfig = config && config.change &&
|
||||||
|
config.change.disable_private_changes;
|
||||||
|
}));
|
||||||
|
|
||||||
|
return Promise.all(promises);
|
||||||
},
|
},
|
||||||
|
|
||||||
observers: [
|
observers: [
|
||||||
@@ -63,7 +77,7 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
_computeBranchClass(baseChange) {
|
_computeBranchClass(baseChange) {
|
||||||
return baseChange ? 'hideBranch' : '';
|
return baseChange ? 'hide' : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
_allowCreate(branch, subject) {
|
_allowCreate(branch, subject) {
|
||||||
@@ -120,5 +134,9 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_computePrivateSectionClass(config) {
|
||||||
|
return config ? 'hide' : '';
|
||||||
|
},
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
@@ -158,5 +158,15 @@ limitations under the License.
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('_computeBranchClass', () => {
|
||||||
|
assert.equal(element._computeBranchClass(true), 'hide');
|
||||||
|
assert.equal(element._computeBranchClass(false), '');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('_computePrivateSectionClass', () => {
|
||||||
|
assert.equal(element._computePrivateSectionClass(true), 'hide');
|
||||||
|
assert.equal(element._computePrivateSectionClass(false), '');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user