mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 19:06:18 +01:00 
			
		
		
		
	Fix issue label rendering in the issue popup (#30763)
This commit is contained in:
		| @@ -1,6 +1,5 @@ | ||||
| <script> | ||||
| import {SvgIcon} from '../svg.js'; | ||||
| import {contrastColor} from '../utils/color.js'; | ||||
| import {GET} from '../modules/fetch.js'; | ||||
|  | ||||
| const {appSubUrl, i18n} = window.config; | ||||
| @@ -10,6 +9,7 @@ export default { | ||||
|   data: () => ({ | ||||
|     loading: false, | ||||
|     issue: null, | ||||
|     renderedLabels: '', | ||||
|     i18nErrorOccurred: i18n.error_occurred, | ||||
|     i18nErrorMessage: null, | ||||
|   }), | ||||
| @@ -56,14 +56,6 @@ export default { | ||||
|       } | ||||
|       return 'red'; // Closed Issue | ||||
|     }, | ||||
|  | ||||
|     labels() { | ||||
|       return this.issue.labels.map((label) => ({ | ||||
|         name: label.name, | ||||
|         color: `#${label.color}`, | ||||
|         textColor: contrastColor(`#${label.color}`), | ||||
|       })); | ||||
|     }, | ||||
|   }, | ||||
|   mounted() { | ||||
|     this.$refs.root.addEventListener('ce-load-context-popup', (e) => { | ||||
| @@ -79,13 +71,14 @@ export default { | ||||
|       this.i18nErrorMessage = null; | ||||
|  | ||||
|       try { | ||||
|         const response = await GET(`${appSubUrl}/${data.owner}/${data.repo}/issues/${data.index}/info`); | ||||
|         const response = await GET(`${appSubUrl}/${data.owner}/${data.repo}/issues/${data.index}/info`); // backend: GetIssueInfo | ||||
|         const respJson = await response.json(); | ||||
|         if (!response.ok) { | ||||
|           this.i18nErrorMessage = respJson.message ?? i18n.network_error; | ||||
|           return; | ||||
|         } | ||||
|         this.issue = respJson; | ||||
|         this.issue = respJson.convertedIssue; | ||||
|         this.renderedLabels = respJson.renderedLabels; | ||||
|       } catch { | ||||
|         this.i18nErrorMessage = i18n.network_error; | ||||
|       } finally { | ||||
| @@ -102,16 +95,8 @@ export default { | ||||
|       <p><small>{{ issue.repository.full_name }} on {{ createdAt }}</small></p> | ||||
|       <p><svg-icon :name="icon" :class="['text', color]"/> <strong>{{ issue.title }}</strong> #{{ issue.number }}</p> | ||||
|       <p>{{ body }}</p> | ||||
|       <div class="labels-list"> | ||||
|         <div | ||||
|           v-for="label in labels" | ||||
|           :key="label.name" | ||||
|           class="ui label" | ||||
|           :style="{ color: label.textColor, backgroundColor: label.color }" | ||||
|         > | ||||
|           {{ label.name }} | ||||
|         </div> | ||||
|       </div> | ||||
|       <!-- eslint-disable-next-line vue/no-v-html --> | ||||
|       <div v-html="renderedLabels"/> | ||||
|     </div> | ||||
|     <div v-if="!loading && issue === null"> | ||||
|       <p><small>{{ i18nErrorOccurred }}</small></p> | ||||
|   | ||||
| @@ -53,7 +53,7 @@ export function initCommonIssueListQuickGoto() { | ||||
|     // try to check whether the parsed goto link is valid | ||||
|     let targetUrl = parseIssueListQuickGotoLink(repoLink, searchText); | ||||
|     if (targetUrl) { | ||||
|       const res = await GET(`${targetUrl}/info`); | ||||
|       const res = await GET(`${targetUrl}/info`); // backend: GetIssueInfo, it only checks whether the issue exists by status code | ||||
|       if (res.status !== 200) targetUrl = ''; | ||||
|     } | ||||
|     // if the input value has changed, then ignore the result | ||||
|   | ||||
		Reference in New Issue
	
	Block a user