Ensure isSSH is set whenever DISABLE_HTTP_GIT is set (#19028)
When DISABLE_HTTP_GIT is set we should always show the SSH button
This commit is contained in:
		
							parent
							
								
									ea46142bce
								
							
						
					
					
						commit
						c21735b49a
					
				| @ -19,17 +19,24 @@ | |||||||
| 	</button> | 	</button> | ||||||
| {{end}} | {{end}} | ||||||
| {{if not (and $.DisableHTTP $.DisableSSH)}} | {{if not (and $.DisableHTTP $.DisableSSH)}} | ||||||
| 	<script defer> | 	<script> | ||||||
| 		const isSSH = localStorage.getItem('repo-clone-protocol') === 'ssh'; | 		<!-- /* eslint-disable */ --> | ||||||
| 		const sshButton = document.getElementById('repo-clone-ssh'); | 		window.config.pageData['repoCloneButtons']= {httpsDisabled: {{$.DisableHTTP}}}; | ||||||
| 		const httpsButton = document.getElementById('repo-clone-https'); | 	</script> | ||||||
| 		const input = document.getElementById('repo-clone-url'); | 	<script> | ||||||
| 		if (input) input.value = (isSSH ? sshButton : httpsButton).getAttribute('data-link'); | 		(() => { | ||||||
| 		if (sshButton) sshButton.classList[isSSH ? 'add' : 'remove']('primary'); | 			const tmplData = window.config.pageData.repoCloneButtons; | ||||||
| 		if (httpsButton) httpsButton.classList[isSSH ? 'remove' : 'add']('primary'); | 			const isSSH = tmplData.httpsDisabled || localStorage.getItem('repo-clone-protocol') === 'ssh'; | ||||||
| 		setTimeout(() => { | 			const sshButton = document.getElementById('repo-clone-ssh'); | ||||||
| 			if (sshButton) sshButton.classList.remove('no-transition'); | 			const httpsButton = document.getElementById('repo-clone-https'); | ||||||
| 			if (httpsButton) httpsButton.classList.remove('no-transition'); | 			const input = document.getElementById('repo-clone-url'); | ||||||
| 		}, 100); | 			if (input) input.value = (isSSH ? sshButton : httpsButton).getAttribute('data-link'); | ||||||
|  | 			if (sshButton) sshButton.classList[isSSH ? 'add' : 'remove']('primary'); | ||||||
|  | 			if (httpsButton) httpsButton.classList[isSSH ? 'remove' : 'add']('primary'); | ||||||
|  | 			setTimeout(() => { | ||||||
|  | 				if (sshButton) sshButton.classList.remove('no-transition'); | ||||||
|  | 				if (httpsButton) httpsButton.classList.remove('no-transition'); | ||||||
|  | 			}, 100); | ||||||
|  | 		})(); | ||||||
| 	</script> | 	</script> | ||||||
| {{end}} | {{end}} | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user