gr-create-change-dialog: Pass private-by-defaut value

Allow to propagate private-by-defaut configuration value. It also avoids
unnecessary requests, when invoked from the change view, because the
project configuration was already retrieved and can be just re-used.

Bug: Issue 8601
Change-Id: I5cdb3f0e12c53bf656653b0821c94317ba7fbb2d
This commit is contained in:
Paladox none 2018-03-20 23:44:58 +00:00 committed by David Ostrovsky
parent c048800482
commit d0f2bda7e8
6 changed files with 11 additions and 8 deletions

@ -104,7 +104,7 @@ limitations under the License.
<input
type="checkbox"
id="privateChangeCheckBox"
checked$="[[_formatBooleanString(_repoConfig.private_by_default)]]">
checked$="[[_formatBooleanString(privateByDefault)]]">
</span>
</section>
</div>

@ -34,6 +34,7 @@
},
},
baseChange: String,
privateByDefault: String,
canCreate: {
type: Boolean,
notify: true,
@ -47,8 +48,9 @@
],
attached() {
if (!this.repoName) { return; }
this.$.restAPI.getProjectConfig(this.repoName).then(config => {
this._repoConfig = config;
this.privateByDefault = config.private_by_default;
});
},

@ -102,11 +102,9 @@ limitations under the License.
});
test('new change created with private', done => {
element._repoConfig = {
private_by_default: {
configured_value: 'TRUE',
inherited_value: false,
},
element.privateByDefault = {
configured_value: 'TRUE',
inherited_value: false,
};
sandbox.stub(element, '_formatBooleanString', () => {
return Promise.resolve(true);

@ -174,7 +174,8 @@ limitations under the License.
id="createFollowUpChange"
branch="[[change.branch]]"
base-change="[[change.id]]"
repo-name="[[change.project]]"></gr-create-change-dialog>
repo-name="[[change.project]]"
private-by-default="[[privateByDefault]]"></gr-create-change-dialog>
</div>
</gr-confirm-dialog>
<gr-confirm-dialog

@ -233,6 +233,7 @@
type: Object,
value() { return {}; },
},
privateByDefault: String,
_loading: {
type: Boolean,

@ -394,6 +394,7 @@ limitations under the License.
edit-patchset-loaded="[[hasEditPatchsetLoaded(_patchRange.*)]]"
edit-mode="[[_editMode]]"
edit-based-on-current-patch-set="[[hasEditBasedOnCurrentPatchSet(_allPatchSets)]]"
private-by-default="[[_projectConfig.private_by_default]]"
on-reload-change="_handleReloadChange"
on-edit-tap="_handleEditTap"
on-stop-edit-tap="_handleStopEditTap"