Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit d91b759

Browse files
committed
Continue
1 parent 73eb73f commit d91b759

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,18 @@ You can also install this add-on manually by using one of the ZIP files on the [
4949
- **1.2** - Copy Merge Request information (intended for sharing on e.g instant messaging softwares)
5050
- **1.3** - Direct Jira ticket link (automatic detection of ticket ID in source branch name or Merge Request title)
5151
- **1.4** - WIP toggle button
52-
- 👉 **1.5** - New option: enable display Merge Request source and target branches name
52+
- 👉 **1.5** - New option: enable display Merge Request source and target branches
5353
- **1.6** - Automatic update of pipeline status and conflict icons
5454

5555
## FAQ
5656

5757
- Why is there still clickable links on deleted source/target branches name?
5858

59-
Due to a technical GitLab limitation, the extension has no reliable way to determine if a branch has been deleted. Therefore, branches name are always links and are always clickable.
59+
Due to a technical GitLab limitation, the extension has no reliable way to determine if a branch has been deleted. Therefore, branches name are always links and are always clickable even though it's leading to a 404 page.
60+
61+
- Can you display a link to the Merge Request linked to the target branch, if any?
62+
63+
It would be great, however the extension has no reliable way to do that due to a technical GitLab limitation.
6064

6165
## License
6266

js/options.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
this.optionsForm = document.querySelector('form');
2424
this.submitButtonInOptionsForm = this.optionsForm.querySelector('button[type="submit"]');
2525

26-
this.enableButtonsToCopySourceAndTargetBranchesNameCheckbox = document.querySelector('input#enable_buttons_to_copy_source_and_target_branches_name');
2726
this.displaySourceTargetBranchesOptionsDiv = document.querySelector('div#display-source-target-branches-options');
27+
this.displaySourceAndTargetBranchesCheckbox = document.querySelector('input#display_source_and_target_branches');
28+
this.enableButtonsToCopySourceAndTargetBranchesNameCheckbox = document.querySelector('input#enable_buttons_to_copy_source_and_target_branches_name');
2829

2930
this.copyMrInfoOptionsDiv = document.querySelector('div#copy-mr-info-options');
3031
this.enableButtonToCopyMrInfoCheckbox = document.querySelector('input#enable_button_to_copy_mr_info');
@@ -45,6 +46,9 @@
4546
let self = this;
4647

4748
this.preferencesManager.getAll(function(preferences) {
49+
self.displaySourceAndTargetBranchesCheckbox.checked = preferences.display_source_and_target_branches;
50+
self.displaySourceAndTargetBranchesCheckbox.dispatchEvent(new CustomEvent('change'));
51+
4852
self.enableButtonsToCopySourceAndTargetBranchesNameCheckbox.checked = preferences.enable_buttons_to_copy_source_and_target_branches_name;
4953

5054
self.enableButtonToCopyMrInfoCheckbox.checked = preferences.enable_button_to_copy_mr_info;
@@ -81,6 +85,10 @@
8185
self.saveOptionsToStorage();
8286
});
8387

88+
this.displaySourceAndTargetBranchesCheckbox.addEventListener('change', function() {
89+
self.displaySourceTargetBranchesOptionsDiv.classList.toggle('is-hidden', !this.checked);
90+
});
91+
8492
this.enableButtonToCopyMrInfoCheckbox.addEventListener('change', function() {
8593
self.copyMrInfoOptionsDiv.classList.toggle('is-hidden', !this.checked);
8694
self.copyMrInfoFormatTextarea.toggleAttribute('required', this.checked);
@@ -108,6 +116,7 @@
108116

109117
this.preferencesManager.setAll(
110118
{
119+
display_source_and_target_branches: this.displaySourceAndTargetBranchesCheckbox.checked,
111120
enable_buttons_to_copy_source_and_target_branches_name: this.enableButtonsToCopySourceAndTargetBranchesNameCheckbox.checked,
112121
enable_button_to_copy_mr_info: this.enableButtonToCopyMrInfoCheckbox.checked,
113122
copy_mr_info_format: this.copyMrInfoFormatTextarea.value,

0 commit comments

Comments
 (0)