mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 19:17:48 +00:00 
			
		
		
		
	feat: Add title while linking the linear issue (#9529)
This commit is contained in:
		| @@ -19,10 +19,11 @@ class LinearAPI extends ApiClient { | |||||||
|     return axios.post(`${this.url}/create_issue`, data); |     return axios.post(`${this.url}/create_issue`, data); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   link_issue(conversationId, issueId) { |   link_issue(conversationId, issueId, title) { | ||||||
|     return axios.post(`${this.url}/link_issue`, { |     return axios.post(`${this.url}/link_issue`, { | ||||||
|       issue_id: issueId, |       issue_id: issueId, | ||||||
|       conversation_id: conversationId, |       conversation_id: conversationId, | ||||||
|  |       title: title, | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -117,6 +117,10 @@ const props = defineProps({ | |||||||
|     type: [Number, String], |     type: [Number, String], | ||||||
|     required: true, |     required: true, | ||||||
|   }, |   }, | ||||||
|  |   title: { | ||||||
|  |     type: String, | ||||||
|  |     default: null, | ||||||
|  |   }, | ||||||
| }); | }); | ||||||
|  |  | ||||||
| const emit = defineEmits(['close']); | const emit = defineEmits(['close']); | ||||||
| @@ -218,7 +222,7 @@ const createIssue = async () => { | |||||||
|     isCreating.value = true; |     isCreating.value = true; | ||||||
|     const response = await LinearAPI.createIssue(payload); |     const response = await LinearAPI.createIssue(payload); | ||||||
|     const { id: issueId } = response.data; |     const { id: issueId } = response.data; | ||||||
|     await LinearAPI.link_issue(props.conversationId, issueId); |     await LinearAPI.link_issue(props.conversationId, issueId, props.title); | ||||||
|     useAlert(t('INTEGRATION_SETTINGS.LINEAR.ADD_OR_LINK.CREATE_SUCCESS')); |     useAlert(t('INTEGRATION_SETTINGS.LINEAR.ADD_OR_LINK.CREATE_SUCCESS')); | ||||||
|     onClose(); |     onClose(); | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|   | |||||||
| @@ -25,30 +25,35 @@ | |||||||
|       <div v-if="selectedTabIndex === 0" class="flex flex-col px-8 pb-4"> |       <div v-if="selectedTabIndex === 0" class="flex flex-col px-8 pb-4"> | ||||||
|         <create-issue |         <create-issue | ||||||
|           :account-id="accountId" |           :account-id="accountId" | ||||||
|           :conversation-id="conversationId" |           :conversation-id="conversation.id" | ||||||
|  |           :title="title" | ||||||
|           @close="onClose" |           @close="onClose" | ||||||
|         /> |         /> | ||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
|       <div v-else class="flex flex-col px-8 pb-4"> |       <div v-else class="flex flex-col px-8 pb-4"> | ||||||
|         <link-issue :conversation-id="conversationId" @close="onClose" /> |         <link-issue | ||||||
|  |           :conversation-id="conversation.id" | ||||||
|  |           :title="title" | ||||||
|  |           @close="onClose" | ||||||
|  |         /> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
| <script setup> | <script setup> | ||||||
| import { useI18n } from 'dashboard/composables/useI18n'; | import { useI18n } from 'dashboard/composables/useI18n'; | ||||||
| import { ref } from 'vue'; | import { computed, ref } from 'vue'; | ||||||
| import LinkIssue from './LinkIssue.vue'; | import LinkIssue from './LinkIssue.vue'; | ||||||
| import CreateIssue from './CreateIssue.vue'; | import CreateIssue from './CreateIssue.vue'; | ||||||
|  |  | ||||||
| defineProps({ | const props = defineProps({ | ||||||
|   accountId: { |   accountId: { | ||||||
|     type: [Number, String], |     type: [Number, String], | ||||||
|     required: true, |     required: true, | ||||||
|   }, |   }, | ||||||
|   conversationId: { |   conversation: { | ||||||
|     type: [Number, String], |     type: Object, | ||||||
|     required: true, |     required: true, | ||||||
|   }, |   }, | ||||||
| }); | }); | ||||||
| @@ -57,6 +62,14 @@ const { t } = useI18n(); | |||||||
|  |  | ||||||
| const selectedTabIndex = ref(0); | const selectedTabIndex = ref(0); | ||||||
|  |  | ||||||
|  | const title = computed(() => { | ||||||
|  |   const { meta: { sender: { name = null } = {} } = {} } = props.conversation; | ||||||
|  |   return t('INTEGRATION_SETTINGS.LINEAR.LINK.LINK_TITLE', { | ||||||
|  |     conversationId: props.conversation.id, | ||||||
|  |     name, | ||||||
|  |   }); | ||||||
|  | }); | ||||||
|  |  | ||||||
| const emits = defineEmits(['close']); | const emits = defineEmits(['close']); | ||||||
|  |  | ||||||
| const tabs = ref([ | const tabs = ref([ | ||||||
|   | |||||||
| @@ -56,6 +56,10 @@ const props = defineProps({ | |||||||
|     type: [Number, String], |     type: [Number, String], | ||||||
|     required: true, |     required: true, | ||||||
|   }, |   }, | ||||||
|  |   title: { | ||||||
|  |     type: String, | ||||||
|  |     default: null, | ||||||
|  |   }, | ||||||
| }); | }); | ||||||
|  |  | ||||||
| const emits = defineEmits(['close']); | const emits = defineEmits(['close']); | ||||||
| @@ -113,7 +117,7 @@ const linkIssue = async () => { | |||||||
|   const { id: issueId } = selectedOption.value; |   const { id: issueId } = selectedOption.value; | ||||||
|   try { |   try { | ||||||
|     isLinking.value = true; |     isLinking.value = true; | ||||||
|     await LinearAPI.link_issue(props.conversationId, issueId); |     await LinearAPI.link_issue(props.conversationId, issueId, props.title); | ||||||
|     useAlert(t('INTEGRATION_SETTINGS.LINEAR.LINK.LINK_SUCCESS')); |     useAlert(t('INTEGRATION_SETTINGS.LINEAR.LINK.LINK_SUCCESS')); | ||||||
|     searchQuery.value = ''; |     searchQuery.value = ''; | ||||||
|     issues.value = []; |     issues.value = []; | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ | |||||||
|       class="!items-start [&>div]:!top-12" |       class="!items-start [&>div]:!top-12" | ||||||
|     > |     > | ||||||
|       <create-or-link-issue |       <create-or-link-issue | ||||||
|         :conversation-id="conversationId" |         :conversation="conversation" | ||||||
|         :account-id="currentAccountId" |         :account-id="currentAccountId" | ||||||
|         @close="closePopup" |         @close="closePopup" | ||||||
|       /> |       /> | ||||||
| @@ -63,6 +63,10 @@ const shouldShowPopup = ref(false); | |||||||
|  |  | ||||||
| const currentAccountId = getters.getCurrentAccountId; | const currentAccountId = getters.getCurrentAccountId; | ||||||
|  |  | ||||||
|  | const conversation = computed(() => | ||||||
|  |   getters.getConversationById.value(props.conversationId) | ||||||
|  | ); | ||||||
|  |  | ||||||
| const tooltipText = computed(() => { | const tooltipText = computed(() => { | ||||||
|   return linkedIssue.value === null |   return linkedIssue.value === null | ||||||
|     ? t('INTEGRATION_SETTINGS.LINEAR.ADD_OR_LINK_BUTTON') |     ? t('INTEGRATION_SETTINGS.LINEAR.ADD_OR_LINK_BUTTON') | ||||||
| @@ -86,7 +90,7 @@ const unlinkIssue = async linkId => { | |||||||
|     linkedIssue.value = null; |     linkedIssue.value = null; | ||||||
|     useAlert(t('INTEGRATION_SETTINGS.LINEAR.UNLINK.SUCCESS')); |     useAlert(t('INTEGRATION_SETTINGS.LINEAR.UNLINK.SUCCESS')); | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|     useAlert(t('INTEGRATION_SETTINGS.LINEAR.UNLINK.DELETE_ERROR')); |     useAlert(t('INTEGRATION_SETTINGS.LINEAR.UNLINK.ERROR')); | ||||||
|   } |   } | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -217,7 +217,8 @@ | |||||||
|         "LOADING": "Loading", |         "LOADING": "Loading", | ||||||
|         "ERROR": "There was an error fetching the linear issues, please try again", |         "ERROR": "There was an error fetching the linear issues, please try again", | ||||||
|         "LINK_SUCCESS": "Issue linked successfully", |         "LINK_SUCCESS": "Issue linked successfully", | ||||||
|         "LINK_ERROR": "There was an error linking the issue, please try again" |         "LINK_ERROR": "There was an error linking the issue, please try again", | ||||||
|  |         "LINK_TITLE": "#%{conversationId}: %{name}" | ||||||
|       }, |       }, | ||||||
|       "ADD_OR_LINK": { |       "ADD_OR_LINK": { | ||||||
|         "TITLE": "Create/link linear issue", |         "TITLE": "Create/link linear issue", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Muhsin Keloth
					Muhsin Keloth