add requesting review

This commit is contained in:
Kushan Joshi
2017-07-24 16:18:47 +05:30
parent 94fe32eaf0
commit b5ece16432
4 changed files with 47 additions and 0 deletions
+39
View File
@@ -173,6 +173,20 @@ export function uiCommit(context) {
.attr('class', 'commit-info')
.html(t('commit.upload_explanation'));
var requestReview = saveSection
.append('p')
.attr('class', 'request-review')
.html( t('commit.request_review'))
.append('a')
.attr('target', '_blank')
.attr('tabindex', -1)
.call(svgIcon('#icon-out-link', 'inline'))
.attr('href', t('commit.request_review_link'));
requestReview
.append('input')
.attr('type', 'checkbox')
.on('change', toggleRequestReview());
context.connection().userDetails(function(err, user) {
if (err) return;
@@ -375,6 +389,31 @@ export function uiCommit(context) {
};
}
function toggleRequestReview() {
var toggled = false;
return function() {
var changeset;
if (toggled) {
changeset = updateChangeset({
review_requested: undefined
});
} else {
changeset = updateChangeset({
review_requested: 'yes'
});
}
toggled = !toggled;
var expanded = !tagSection
.selectAll('a.hide-toggle.expanded')
.empty();
tagSection.call(rawTagEditor
.expanded(expanded)
.readOnlyTags(readOnlyTags)
.tags(_.clone(changeset.tags)));
};
}
function changeTags(changed) {
if (changed.hasOwnProperty('comment')) {