Compare commits

..

1 Commits

Author SHA1 Message Date
Henry
347f6fcb50 fix: list dnd when board exceeds viewport width 2026-06-25 16:59:01 +01:00
2 changed files with 20 additions and 32 deletions

View File

@@ -8,24 +8,20 @@ import * as checklistRepo from "@kan/db/repository/checklist.repo";
import * as labelRepo from "@kan/db/repository/label.repo"; import * as labelRepo from "@kan/db/repository/label.repo";
import * as listRepo from "@kan/db/repository/list.repo"; import * as listRepo from "@kan/db/repository/list.repo";
import * as workspaceRepo from "@kan/db/repository/workspace.repo"; import * as workspaceRepo from "@kan/db/repository/workspace.repo";
import { generateAttachmentUrl, generateAvatarUrl } from "@kan/shared/utils";
import {
activityItemSchema,
cardCreateResponseSchema,
cardDetailSchema,
cardUpdateResponseSchema,
commentDeleteResponseSchema,
commentResponseSchema,
} from "../schemas";
import { createTRPCRouter, protectedProcedure, publicProcedure } from "../trpc"; import { createTRPCRouter, protectedProcedure, publicProcedure } from "../trpc";
import {
cardCreateResponseSchema,
cardUpdateResponseSchema,
cardDetailSchema,
commentResponseSchema,
commentDeleteResponseSchema,
activityItemSchema,
} from "../schemas";
import { mergeActivities } from "../utils/activities"; import { mergeActivities } from "../utils/activities";
import { sendMentionEmails } from "../utils/notifications"; import { sendMentionEmails } from "../utils/notifications";
import { import { assertCanDelete, assertCanEdit, assertPermission } from "../utils/permissions";
assertCanDelete, import { generateAttachmentUrl, generateAvatarUrl } from "@kan/shared/utils";
assertCanEdit,
assertPermission,
} from "../utils/permissions";
import { import {
createCardWebhookPayload, createCardWebhookPayload,
sendWebhooksForWorkspace, sendWebhooksForWorkspace,
@@ -250,12 +246,7 @@ export const cardRouter = createTRPCRouter({
code: "NOT_FOUND", code: "NOT_FOUND",
}); });
await assertPermission( await assertPermission(ctx.db, userId, card.workspaceId, "comment:create");
ctx.db,
userId,
card.workspaceId,
"comment:create",
);
const newComment = await cardCommentRepo.create(ctx.db, { const newComment = await cardCommentRepo.create(ctx.db, {
comment: input.comment, comment: input.comment,
@@ -333,7 +324,7 @@ export const cardRouter = createTRPCRouter({
input.commentPublicId, input.commentPublicId,
); );
if (!existingComment || existingComment.cardId !== card.id) if (!existingComment)
throw new TRPCError({ throw new TRPCError({
message: `Comment with public ID ${input.commentPublicId} not found`, message: `Comment with public ID ${input.commentPublicId} not found`,
code: "NOT_FOUND", code: "NOT_FOUND",
@@ -421,7 +412,7 @@ export const cardRouter = createTRPCRouter({
input.commentPublicId, input.commentPublicId,
); );
if (!existingComment || existingComment.cardId !== card.id) if (!existingComment)
throw new TRPCError({ throw new TRPCError({
message: `Comment with public ID ${input.commentPublicId} not found`, message: `Comment with public ID ${input.commentPublicId} not found`,
code: "NOT_FOUND", code: "NOT_FOUND",
@@ -910,7 +901,10 @@ export const cardRouter = createTRPCRouter({
| undefined; | undefined;
if (input.listPublicId) { if (input.listPublicId) {
newList = await listRepo.getByPublicId(ctx.db, input.listPublicId); newList = await listRepo.getByPublicId(
ctx.db,
input.listPublicId,
);
if (!newList) if (!newList)
throw new TRPCError({ throw new TRPCError({
@@ -1054,14 +1048,12 @@ export const cardRouter = createTRPCRouter({
) { ) {
webhookChanges.dueDate = { from: previousDueDate, to: input.dueDate }; webhookChanges.dueDate = { from: previousDueDate, to: input.dueDate };
} }
const movedToNewList = Boolean( const movedToNewList = Boolean(newListId && existingCard.listId !== newListId);
newListId && existingCard.listId !== newListId,
);
const currentWebhookListPublicId = movedToNewList const currentWebhookListPublicId = movedToNewList
? input.listPublicId! ? input.listPublicId!
: existingCard.list.publicId; : existingCard.list.publicId;
const currentWebhookListName = movedToNewList const currentWebhookListName = movedToNewList
? (newList?.name ?? card.listName) ? newList?.name ?? card.listName
: existingCard.list.name; : existingCard.list.name;
if (movedToNewList) { if (movedToNewList) {
@@ -1299,10 +1291,7 @@ export const cardRouter = createTRPCRouter({
if (input.copyLabels && sourceCard.labels?.length) { if (input.copyLabels && sourceCard.labels?.length) {
const labelPublicIds = sourceCard.labels.map((l) => l.publicId); const labelPublicIds = sourceCard.labels.map((l) => l.publicId);
const labels = await labelRepo.getAllByPublicIds( const labels = await labelRepo.getAllByPublicIds(ctx.db, labelPublicIds);
ctx.db,
labelPublicIds,
);
if (labels.length) { if (labels.length) {
const labelsInsert = labels.map((label) => ({ const labelsInsert = labels.map((label) => ({
cardId: newCard.id, cardId: newCard.id,

View File

@@ -45,7 +45,6 @@ export const getByPublicId = (db: dbClient, publicId: string) => {
publicId: true, publicId: true,
comment: true, comment: true,
createdBy: true, createdBy: true,
cardId: true,
}, },
where: eq(comments.publicId, publicId), where: eq(comments.publicId, publicId),
}); });