⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat(api): sync labels to gitlab issues
zaralXc64083510c98
diff --git a/apps/api/src/label/controllers/assign-label-to-task.ts b/apps/api/src/label/controllers/assign-label-to-task.tsindex 6e7adaa05..10f8753fa 100644--- a/apps/api/src/label/controllers/assign-label-to-task.ts+++ b/apps/api/src/label/controllers/assign-label-to-task.ts@@ -16,6 +16,10 @@ import {removeLabelFromGitHub,syncLabelToGitHub,} from "../../plugins/github/utils/sync-label-to-github";+import {+ removeLabelFromGitlab,+ syncLabelToGitlab,+} from "../../plugins/gitlab/utils/sync-label-to-gitlab";type LabelRow = typeof labelTableType.$inferSelect;@@ -148,6 +152,9 @@ async function assignLabelToTask(id: string, taskId: string, userId: string) {removeLabelFromGitea(previousTaskId, previousName).catch((error) => {console.error("Failed to remove label from Gitea:", error);});+ removeLabelFromGitlab(previousTaskId, previousName).catch((error) => {+ console.error("Failed to remove label from GitLab:", error);+ });}if (!inserted) {@@ -160,6 +167,9 @@ async function assignLabelToTask(id: string, taskId: string, userId: string) {syncLabelToGitea(taskId, taskLabel.name, taskLabel.color).catch((error) => {console.error("Failed to sync label to Gitea:", error);});+ syncLabelToGitlab(taskId, taskLabel.name, taskLabel.color).catch((error) => {+ console.error("Failed to sync label to GitLab:", error);+ });await publishEvent("task.label_assigned", {label: taskLabel,diff --git a/apps/api/src/label/controllers/create-label.ts b/apps/api/src/label/controllers/create-label.tsindex 33dcce2e6..506840811 100644--- a/apps/api/src/label/controllers/create-label.ts+++ b/apps/api/src/label/controllers/create-label.ts@@ -5,6 +5,7 @@ import { labelTable, projectTable, taskTable } from "../../database/schema";import { publishEvent } from "../../events";import { syncLabelToGitea } from "../../plugins/gitea/utils/sync-label-to-gitea";import { syncLabelToGitHub } from "../../plugins/github/utils/sync-label-to-github";+import { syncLabelToGitlab } from "../../plugins/gitlab/utils/sync-label-to-gitlab";async function createLabel(name: string,@@ -62,6 +63,9 @@ async function createLabel(syncLabelToGitea(taskId, name, color).catch((error) => {console.error("Failed to sync label to Gitea:", error);});+ syncLabelToGitlab(taskId, name, color).catch((error) => {+ console.error("Failed to sync label to GitLab:", error);+ });await publishEvent("task.label_created", {projectId: task.projectId,diff --git a/apps/api/src/label/controllers/delete-label.ts b/apps/api/src/label/controllers/delete-label.tsindex 3abd1cfde..d0ec87ac9 100644--- a/apps/api/src/label/controllers/delete-label.ts+++ b/apps/api/src/label/controllers/delete-label.ts@@ -5,6 +5,7 @@ import { labelTable, projectTable, taskTable } from "../../database/schema";import { publishEvent } from "../../events";import { removeLabelFromGitea } from "../../plugins/gitea/utils/sync-label-to-gitea";import { removeLabelFromGitHub } from "../../plugins/github/utils/sync-label-to-github";+import { removeLabelFromGitlab } from "../../plugins/gitlab/utils/sync-label-to-gitlab";async function deleteLabel(id: string, userId: string) {const label = await db.query.labelTable.findFirst({@@ -124,6 +125,9 @@ async function deleteLabel(id: string, userId: string) {removeLabelFromGitea(l.taskId, l.name).catch((error) => {console.error("Failed to remove label from Gitea:", error);});+ removeLabelFromGitlab(l.taskId, l.name).catch((error) => {+ console.error("Failed to remove label from GitLab:", error);+ });}await publishEvent("task.label_deleted", {diff --git a/apps/api/src/task/controllers/bulk-update-tasks.ts b/apps/api/src/task/controllers/bulk-update-tasks.tsindex f25c41f88..5a59079a7 100644--- a/apps/api/src/task/controllers/bulk-update-tasks.ts+++ b/apps/api/src/task/controllers/bulk-update-tasks.ts@@ -12,6 +12,7 @@ import {import { publishEvent } from "../../events";import { removeLabelFromGitea } from "../../plugins/gitea/utils/sync-label-to-gitea";import { removeLabelFromGitHub } from "../../plugins/github/utils/sync-label-to-github";+import { removeLabelFromGitlab } from "../../plugins/gitlab/utils/sync-label-to-gitlab";import { assertAssignableUser } from "../../utils/assert-assignable-user";import {assertValidPriority,@@ -315,6 +316,11 @@ async function bulkUpdateTasks({console.error("Failed to remove label from Gitea:", error);},);+ removeLabelFromGitlab(deletedLabel.taskId, deletedLabel.name).catch(+ (error) => {+ console.error("Failed to remove label from GitLab:", error);+ },+ );const task = tasks.find((t) => t.id === deletedLabel.taskId);if (!task) continue;