automatically set patch proposed for all users (not just admins)

This commit is contained in:
Frédéric Péters 2017-01-28 11:49:46 +01:00
parent 939468a414
commit 9c9c07549a
1 changed files with 21 additions and 19 deletions

View File

@ -80,11 +80,29 @@ function sort_table() {
$(function() {
$('.wiki table tr:first-child td').on('click', sort_table).css('cursor', 'row-resize');
if ($('.administration').length == 0) {
/* fake access control */
if ($('body.controller-issues.action-show').length == 0) {
return;
}
if ($('body.controller-issues.action-show').length == 0) {
if ($('#attachments_fields').length) {
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(mutation);
$('input.filename.readonly').each(function(idx, elem) {
var filename = $(elem).val();
var extension = filename.substring(filename.lastIndexOf('.'));
if (extension == '.patch') {
$('#issue_custom_field_values_2').prop('checked', true);
}
});
});
});
var target = $('#attachments_fields')[0];
observer.observe(target, {attributes: false, childList: true, characterData: false});
}
if ($('.administration').length == 0) {
/* fake access control */
return;
}
var issue_no = $('a.atom').attr('href').split('/')[2].split('.')[0];
@ -105,20 +123,4 @@ $(function() {
}
}
});
if ($('#attachments_fields').length) {
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(mutation);
$('input.filename.readonly').each(function(idx, elem) {
var filename = $(elem).val();
var extension = filename.substring(filename.lastIndexOf('.'));
if (extension == '.patch') {
$('#issue_custom_field_values_2').prop('checked', true);
}
});
});
});
var target = $('#attachments_fields')[0];
observer.observe(target, {attributes: false, childList: true, characterData: false});
}
});