##// END OF EJS Templates
pull-requests: fixed cases with default expected refs are closed or unavailable....
ergo -
r2555:1d84c2ba stable
parent child Browse files
Show More
@@ -217,6 +217,12 b' ReviewersController = function () {'
217 prButtonLock(true, null, 'reviewers');
217 prButtonLock(true, null, 'reviewers');
218 $('#user').hide(); // hide user autocomplete before load
218 $('#user').hide(); // hide user autocomplete before load
219
219
220 if (sourceRef.length !== 3 || targetRef.length !== 3) {
221 // don't load defaults in case we're missing some refs...
222 $('.calculate-reviewers').hide();
223 return
224 }
225
220 var url = pyroutes.url('repo_default_reviewers_data',
226 var url = pyroutes.url('repo_default_reviewers_data',
221 {
227 {
222 'repo_name': templateContext.repo_name,
228 'repo_name': templateContext.repo_name,
@@ -202,9 +202,13 b''
202 // translate our select2 id into a text, it's a mapping to show
202 // translate our select2 id into a text, it's a mapping to show
203 // simple label when selecting by internal ID.
203 // simple label when selecting by internal ID.
204 var id, refData;
204 var id, refData;
205 if (selectedRef === undefined) {
205 if (selectedRef === undefined || selectedRef === null) {
206 id = element.val();
206 id = element.val();
207 refData = element.val().split(':');
207 refData = element.val().split(':');
208
209 if (refData.length !== 3){
210 refData = ["", "", ""]
211 }
208 } else {
212 } else {
209 id = selectedRef;
213 id = selectedRef;
210 refData = selectedRef.split(':');
214 refData = selectedRef.split(':');
@@ -216,7 +220,6 b''
216 }
220 }
217
221
218 var data = {id: id, text: text};
222 var data = {id: id, text: text};
219
220 callback(data);
223 callback(data);
221 };
224 };
222 };
225 };
@@ -416,7 +419,9 b''
416 };
419 };
417
420
418 var initTargetRefs = function(refsData, selectedRef){
421 var initTargetRefs = function(refsData, selectedRef) {
422
419 Select2Box($targetRef, {
423 Select2Box($targetRef, {
424 placeholder: "${_('Select commit reference')}",
420 query: function(query) {
425 query: function(query) {
421 queryTargetRefs(refsData, query);
426 queryTargetRefs(refsData, query);
422 },
427 },
@@ -518,7 +523,9 b''
518 % if c.default_source_ref:
523 % if c.default_source_ref:
519 // in case we have a pre-selected value, use it now
524 // in case we have a pre-selected value, use it now
520 $sourceRef.select2('val', '${c.default_source_ref}');
525 $sourceRef.select2('val', '${c.default_source_ref}');
526 // diff preview load
521 loadRepoRefDiffPreview();
527 loadRepoRefDiffPreview();
528 // default reviewers
522 reviewersController.loadDefaultReviewers(
529 reviewersController.loadDefaultReviewers(
523 sourceRepo(), sourceRef(), targetRepo(), targetRef());
530 sourceRepo(), sourceRef(), targetRepo(), targetRef());
524 % endif
531 % endif
General Comments 0
You need to be logged in to leave comments. Login now