This repository was archived by the owner on Aug 31, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 4848 < div class ="browser-style man "> < input type ="radio " required name ="jira_ticket_link_label_type " value ="icon " id ="jira_ticket_link_label_type_icon " class ="man "> < label for ="jira_ticket_link_label_type_icon "> An icon</ label > </ div >
4949 </ div >
5050 </ div >
51- < div class ="pts pbs row ">
51+ < div class ="pts row ">
5252 < div class ="w40p txt-center browser-style ">
5353 < input type ="checkbox " id ="enable_button_to_toggle_wip_status ">
5454 </ div >
5555 < div >
5656 < label for ="enable_button_to_toggle_wip_status "> Enable button allowing to toggle WIP status</ label >
5757 </ div >
5858 </ div >
59+ < div class ="pbs pll ">
60+ < small class ="txt-muted "> This feature is automatically disabled if logged-out</ small >
61+ </ div >
5962 < div class ="txt-center pts pbs "> < button type ="submit " class ="browser-style "> Save preferences</ button > </ div >
6063 </ form >
6164
Original file line number Diff line number Diff line change 123123
124124 this . baseUrl = location . protocol + '//' + location . host ;
125125 this . baseApiUrl = this . baseUrl + '/api/v4/' ;
126+ this . userAuthenticated = this . isUserAuthenticated ( ) ;
126127 this . apiClient = new GitLabApiClient ( this . baseApiUrl , this . getCsrfToken ( ) ) ;
127128
128129 let currentMergeRequestIds = this . getCurrentMergeRequestIds ( ) ;
167168 return meta ? meta . getAttribute ( 'content' ) : null ;
168169 }
169170
171+ /**
172+ * Determines if the current user is logged-in to GitLab.
173+ */
174+ isUserAuthenticated ( ) {
175+ return document . querySelector ( '.navbar-nav .header-user' ) ? true : false ;
176+ }
177+
170178 /**
171179 * Gets all Merge Requests IDs that are currently displayed.
172180 */
199207 self . attachClickEventToCopyMergeRequestInfoButtons ( ) ;
200208 }
201209
202- if ( self . preferences . enable_button_to_toggle_wip_status ) {
210+ if ( self . userAuthenticated && self . preferences . enable_button_to_toggle_wip_status ) {
203211 self . attachClickEventToToggleWipStatusButtons ( ) ;
204212 }
205213 } else {
275283 // -----------------------------------------------
276284 // Toggle WIP status button
277285
278- if ( this . preferences . enable_button_to_toggle_wip_status ) {
286+ if ( this . userAuthenticated && this . preferences . enable_button_to_toggle_wip_status ) {
279287 let toggleWipStatusButton = '<button class="btn btn-secondary btn-md btn-default btn-transparent btn-clipboard has-tooltip gmrle-toggle-wip-status" title="Toggle WIP status" style="padding-left: 0">' +
280288 '<i class="fa fa-wrench" aria-hidden="true"></i>' +
281289 '</button> ' ;
You can’t perform that action at this time.
0 commit comments