mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-30 19:15:23 +01:00 
			
		
		
		
	Fix some log and UI problems (#34863)
Remove the misleading error log, fix #34738 Make the "search" input auto-focused, fix #34807
This commit is contained in:
		
							parent
							
								
									35a8e6f8e9
								
							
						
					
					
						commit
						1839110ea6
					
				| @ -91,7 +91,7 @@ func AddGPGKey(ctx context.Context, ownerID int64, content, token, signature str | ||||
| 			signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\r\n"), strings.NewReader(signature), nil) | ||||
| 		} | ||||
| 		if err != nil { | ||||
| 			log.Error("Unable to validate token signature. Error: %v", err) | ||||
| 			log.Debug("AddGPGKey CheckArmoredDetachedSignature failed: %v", err) | ||||
| 			return nil, ErrGPGInvalidTokenSignature{ | ||||
| 				ID:      ekeys[0].PrimaryKey.KeyIdString(), | ||||
| 				Wrapped: err, | ||||
|  | ||||
| @ -85,7 +85,7 @@ func VerifyGPGKey(ctx context.Context, ownerID int64, keyID, token, signature st | ||||
| 	} | ||||
| 
 | ||||
| 	if signer == nil { | ||||
| 		log.Error("Unable to validate token signature. Error: %v", err) | ||||
| 		log.Debug("VerifyGPGKey failed: no signer") | ||||
| 		return "", ErrGPGInvalidTokenSignature{ | ||||
| 			ID: key.KeyID, | ||||
| 		} | ||||
|  | ||||
| @ -35,7 +35,7 @@ func VerifySSHKey(ctx context.Context, ownerID int64, fingerprint, token, signat | ||||
| 		// edge case for Windows based shells that will add CR LF if piped to ssh-keygen command | ||||
| 		// see https://github.com/PowerShell/PowerShell/issues/5974 | ||||
| 		if sshsig.Verify(strings.NewReader(token+"\r\n"), []byte(signature), []byte(key.Content), "gitea") != nil { | ||||
| 			log.Error("Unable to validate token signature. Error: %v", err) | ||||
| 			log.Debug("VerifySSHKey sshsig.Verify failed: %v", err) | ||||
| 			return "", ErrSSHInvalidTokenSignature{ | ||||
| 				Fingerprint: key.Fingerprint, | ||||
| 			} | ||||
|  | ||||
| @ -39,7 +39,7 @@ export default defineComponent({ | ||||
|     return { | ||||
|       tab, | ||||
|       repos: [], | ||||
|       reposTotalCount: 0, | ||||
|       reposTotalCount: null, | ||||
|       reposFilter, | ||||
|       archivedFilter, | ||||
|       privateFilter, | ||||
| @ -113,9 +113,6 @@ export default defineComponent({ | ||||
|     const el = document.querySelector('#dashboard-repo-list'); | ||||
|     this.changeReposFilter(this.reposFilter); | ||||
|     fomanticQuery(el.querySelector('.ui.dropdown')).dropdown(); | ||||
|     nextTick(() => { | ||||
|       this.$refs.search?.focus(); | ||||
|     }); | ||||
| 
 | ||||
|     this.textArchivedFilterTitles = { | ||||
|       'archived': this.textShowOnlyArchived, | ||||
| @ -243,12 +240,20 @@ export default defineComponent({ | ||||
| 
 | ||||
|       let response, json; | ||||
|       try { | ||||
|         const firstLoad = this.reposTotalCount === null; | ||||
|         if (!this.reposTotalCount) { | ||||
|           const totalCountSearchURL = `${this.subUrl}/repo/search?count_only=1&uid=${this.uid}&team_id=${this.teamId}&q=&page=1&mode=`; | ||||
|           response = await GET(totalCountSearchURL); | ||||
|           this.reposTotalCount = parseInt(response.headers.get('X-Total-Count') ?? '0'); | ||||
|         } | ||||
| 
 | ||||
|         if (firstLoad && this.reposTotalCount) { | ||||
|           nextTick(() => { | ||||
|             // MDN: If there's no focused element, this is the Document.body or Document.documentElement. | ||||
|             if ((document.activeElement === document.body || document.activeElement === document.documentElement)) { | ||||
|               this.$refs.search.focus({preventScroll: true}); | ||||
|             } | ||||
|           }); | ||||
|         } | ||||
|         response = await GET(searchedURL); | ||||
|         json = await response.json(); | ||||
|       } catch { | ||||
| @ -350,7 +355,7 @@ export default defineComponent({ | ||||
|       <h4 class="ui top attached header tw-flex tw-items-center"> | ||||
|         <div class="tw-flex-1 tw-flex tw-items-center"> | ||||
|           {{ textMyRepos }} | ||||
|           <span class="ui grey label tw-ml-2">{{ reposTotalCount }}</span> | ||||
|           <span v-if="reposTotalCount" class="ui grey label tw-ml-2">{{ reposTotalCount }}</span> | ||||
|         </div> | ||||
|         <a class="tw-flex tw-items-center muted" :href="subUrl + '/repo/create' + (isOrganization ? '?org=' + organizationId : '')" :data-tooltip-content="textNewRepo"> | ||||
|           <svg-icon name="octicon-plus"/> | ||||
| @ -421,7 +426,7 @@ export default defineComponent({ | ||||
|       </div> | ||||
|       <div v-if="repos.length" class="ui attached table segment tw-rounded-b"> | ||||
|         <ul class="repo-owner-name-list"> | ||||
|           <li class="tw-flex tw-items-center tw-py-2" v-for="repo, index in repos" :class="{'active': index === activeIndex}" :key="repo.id"> | ||||
|           <li class="tw-flex tw-items-center tw-py-2" v-for="(repo, index) in repos" :class="{'active': index === activeIndex}" :key="repo.id"> | ||||
|             <a class="repo-list-link muted" :href="repo.link"> | ||||
|               <svg-icon :name="repoIcon(repo)" :size="16" class="repo-list-icon"/> | ||||
|               <div class="text truncate">{{ repo.full_name }}</div> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user