kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at cd7cada2f86b4e866a15b4323bb8d6d7ab5bba8b 45 lines 1.3 kB view raw
1import { findExternalLinksByTask } from "../../github/services/link-manager"; 2import type { PluginContext, TaskPriorityChangedEvent } from "../../types"; 3import type { GiteaConfig } from "../config"; 4import { addLabelsToIssueGitea, removeLabelGitea } from "../utils/labels"; 5 6export async function handleTaskPriorityChanged( 7 event: TaskPriorityChangedEvent, 8 context: PluginContext, 9): Promise<void> { 10 const config = context.config as GiteaConfig; 11 if (!config.baseUrl || !config.accessToken) { 12 return; 13 } 14 15 try { 16 const links = await findExternalLinksByTask(event.taskId); 17 const issueLink = links.find( 18 (link) => 19 link.integrationId === context.integrationId && 20 link.resourceType === "issue", 21 ); 22 23 if (!issueLink) { 24 return; 25 } 26 27 const issueNumber = Number.parseInt(issueLink.externalId, 10); 28 29 if (event.oldPriority && event.oldPriority !== "no-priority") { 30 await removeLabelGitea( 31 config, 32 issueNumber, 33 `priority:${event.oldPriority}`, 34 ); 35 } 36 37 if (event.newPriority && event.newPriority !== "no-priority") { 38 await addLabelsToIssueGitea(config, issueNumber, [ 39 `priority:${event.newPriority}`, 40 ]); 41 } 42 } catch (error) { 43 console.error("Failed to update Gitea issue priority:", error); 44 } 45}