|
132 | 132 | this.baseUrl = location.protocol + '//' + location.host; |
133 | 133 | this.baseApiUrl = this.baseUrl + '/api/v4/'; |
134 | 134 | this.userAuthenticated = this.isUserAuthenticated(); |
| 135 | + this.pipelineFeatureEnabled = this.isPipelineFeatureEnabled(); |
135 | 136 | this.apiClient = new GitLabApiClient(this.baseApiUrl, this.getCsrfToken()); |
136 | 137 |
|
137 | | - let currentMergeRequestIds = this.getCurrentMergeRequestIds(); |
| 138 | + this.currentMergeRequestIds = this.getCurrentMergeRequestIds(); |
| 139 | + |
138 | 140 | let preferencesManager = new globals.Gmrle.PreferencesManager(); |
139 | 141 |
|
140 | 142 | let self = this; |
141 | 143 |
|
142 | 144 | preferencesManager.getAll(function(preferences) { |
143 | 145 | self.preferences = preferences; |
144 | | - self.fetchMergeRequestsDetailsThenUpdateUI(currentMergeRequestIds); |
| 146 | + self.fetchMergeRequestsDetailsThenUpdateUI(self.currentMergeRequestIds); |
145 | 147 | }); |
146 | 148 | } |
147 | 149 |
|
|
183 | 185 | return document.querySelector('.navbar-nav .header-user') ? true : false; |
184 | 186 | } |
185 | 187 |
|
| 188 | + /** |
| 189 | + * Determines if the project do uses the Gitlab "pipeline" feature. |
| 190 | + */ |
| 191 | + isPipelineFeatureEnabled() { |
| 192 | + return document.querySelector('.issuable-pipeline-status') ? true : false; |
| 193 | + } |
| 194 | + |
186 | 195 | /** |
187 | 196 | * Gets all Merge Requests IDs that are currently displayed. |
188 | 197 | */ |
|
220 | 229 | self.attachClickEventToToggleWipStatusButtons(); |
221 | 230 | } |
222 | 231 |
|
223 | | - if (self.preferences.automatically_update_pipeline_status_icons) { |
| 232 | + if (self.pipelineFeatureEnabled && self.preferences.automatically_update_pipeline_status_icons) { |
224 | 233 | self.schedulePipelineStatusIconsUpdate(); |
225 | 234 | } |
226 | 235 | }); |
|
596 | 605 | updatePipelineStatusIcons() { |
597 | 606 | let self = this; |
598 | 607 |
|
599 | | - this.fetchMergeRequestsDetails(mergeRequestIds).then(function(responseData) { |
600 | | - // TODO actually update icons |
| 608 | + this.fetchMergeRequestsDetails(this.currentMergeRequestIds).then(function(responseData) { |
| 609 | + // TODO Actually update icons |
601 | 610 |
|
602 | 611 | self.schedulePipelineStatusIconsUpdate(); |
603 | 612 | }); |
|
0 commit comments