|
196 | 196 | this.apiClient.getProjectMergeRequests( |
197 | 197 | function() { |
198 | 198 | if (this.status == 200) { |
199 | | - self.removeExistingTargetBranchNodes(); |
| 199 | + if (self.preferences.display_source_and_target_branches) { |
| 200 | + self.removeExistingTargetBranchNodes(); |
| 201 | + } |
| 202 | + |
200 | 203 | self.updateMergeRequestsNodes(this.response); |
201 | 204 |
|
202 | 205 | if (self.preferences.enable_buttons_to_copy_source_and_target_branches_name) { |
|
346 | 349 | // ----------------------------------------------- |
347 | 350 | // Source and target branches info |
348 | 351 |
|
349 | | - // Source branch name |
350 | | - let newInfoLineToInject = '<div class="issuable-info">' + |
351 | | - '<span class="project-ref-path has-tooltip" title="Source branch">' + |
352 | | - '<a class="ref-name" href="' + this.baseProjectUrl + '/-/commits/' + mergeRequest.source_branch + '">' + mergeRequest.source_branch + '</a>' + |
353 | | - '</span>'; |
354 | | - |
355 | | - // Copy source branch name button |
356 | | - if (this.preferences.enable_buttons_to_copy_source_and_target_branches_name) { |
357 | | - newInfoLineToInject += ' <button class="btn btn-secondary btn-md btn-default btn-transparent btn-clipboard has-tooltip gmrle-copy-branch-name" title="Copy branch name" data-branch-name-to-copy="source">' + |
358 | | - '<i class="fa fa-clipboard" aria-hidden="true"></i>' + |
359 | | - '</button>'; |
360 | | - } |
| 352 | + if (this.preferences.display_source_and_target_branches) { |
| 353 | + let newInfoLineToInject = '<div class="issuable-info">'; |
361 | 354 |
|
362 | | - // Target branch name |
363 | | - newInfoLineToInject += ' <i class="fa fa-long-arrow-right" aria-hidden="true"></i> ' + |
364 | | - '<span class="project-ref-path has-tooltip" title="Target branch">' + |
365 | | - '<a class="ref-name" href="' + this.baseProjectUrl + '/-/commits/' + mergeRequest.target_branch + '">' + mergeRequest.target_branch + '</a>' + |
366 | | - '</span>'; |
367 | | - |
368 | | - // Copy target branch name button |
369 | | - if (this.preferences.enable_buttons_to_copy_source_and_target_branches_name) { |
370 | | - newInfoLineToInject += ' <button class="btn btn-secondary btn-md btn-default btn-transparent btn-clipboard has-tooltip gmrle-copy-branch-name" title="Copy branch name" data-branch-name-to-copy="target">' + |
371 | | - '<i class="fa fa-clipboard" aria-hidden="true"></i>' + |
372 | | - '</button>'; |
373 | | - } |
| 355 | + // Source branch name |
| 356 | + newInfoLineToInject += '<span class="project-ref-path has-tooltip" title="Source branch">' + |
| 357 | + '<a class="ref-name" href="' + this.baseProjectUrl + '/-/commits/' + mergeRequest.source_branch + '">' + mergeRequest.source_branch + '</a>' + |
| 358 | + '</span>'; |
| 359 | + |
| 360 | + // Copy source branch name button |
| 361 | + if (this.preferences.enable_buttons_to_copy_source_and_target_branches_name) { |
| 362 | + newInfoLineToInject += ' <button class="btn btn-secondary btn-md btn-default btn-transparent btn-clipboard has-tooltip gmrle-copy-branch-name" title="Copy branch name" data-branch-name-to-copy="source">' + |
| 363 | + '<i class="fa fa-clipboard" aria-hidden="true"></i>' + |
| 364 | + '</button>'; |
| 365 | + } |
| 366 | + |
| 367 | + // Target branch name |
| 368 | + newInfoLineToInject += ' <i class="fa fa-long-arrow-right" aria-hidden="true"></i> ' + |
| 369 | + '<span class="project-ref-path has-tooltip" title="Target branch">' + |
| 370 | + '<a class="ref-name" href="' + this.baseProjectUrl + '/-/commits/' + mergeRequest.target_branch + '">' + mergeRequest.target_branch + '</a>' + |
| 371 | + '</span>'; |
| 372 | + |
| 373 | + // Copy target branch name button |
| 374 | + if (this.preferences.enable_buttons_to_copy_source_and_target_branches_name) { |
| 375 | + newInfoLineToInject += ' <button class="btn btn-secondary btn-md btn-default btn-transparent btn-clipboard has-tooltip gmrle-copy-branch-name" title="Copy branch name" data-branch-name-to-copy="target">' + |
| 376 | + '<i class="fa fa-clipboard" aria-hidden="true"></i>' + |
| 377 | + '</button>'; |
| 378 | + } |
374 | 379 |
|
375 | | - newInfoLineToInject += '</div>'; |
| 380 | + newInfoLineToInject += '</div>'; |
376 | 381 |
|
377 | | - this.parseHtmlAndAppend( |
378 | | - mergeRequestNode.querySelector('.issuable-main-info'), |
379 | | - newInfoLineToInject |
380 | | - ); |
| 382 | + this.parseHtmlAndAppend( |
| 383 | + mergeRequestNode.querySelector('.issuable-main-info'), |
| 384 | + newInfoLineToInject |
| 385 | + ); |
| 386 | + } |
381 | 387 | }, this); |
382 | 388 | } |
383 | 389 |
|
|
0 commit comments