Edit text and links, mute and unmute chat

This commit is contained in:
2026-09-30 14:58:44 +03:30
parent d3986da28b
commit 75b83b7f1b
9 changed files with 1070 additions and 51 deletions
@@ -0,0 +1,33 @@
-- Mute per-user (smart: mentions can still notify)
CREATE TABLE "ConversationRoomUserMute" (
"id" TEXT NOT NULL,
"organizationId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"externalRoomId" TEXT NOT NULL,
"allowMentions" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ConversationRoomUserMute_pkey" PRIMARY KEY ("id")
);
CREATE UNIQUE INDEX "ConversationRoomUserMute_organizationId_userId_externalRoomId_key" ON "ConversationRoomUserMute"("organizationId", "userId", "externalRoomId");
CREATE INDEX "ConversationRoomUserMute_organizationId_userId_idx" ON "ConversationRoomUserMute"("organizationId", "userId");
ALTER TABLE "ConversationRoomUserMute" ADD CONSTRAINT "ConversationRoomUserMute_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- Message emoji reactions
CREATE TABLE "ConversationMessageReaction" (
"id" TEXT NOT NULL,
"organizationId" TEXT NOT NULL,
"externalRoomId" TEXT NOT NULL,
"messageId" TEXT NOT NULL,
"emoji" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "ConversationMessageReaction_pkey" PRIMARY KEY ("id")
);
CREATE UNIQUE INDEX "ConversationMessageReaction_organizationId_externalRoomId_messageId_userId_emoji_key" ON "ConversationMessageReaction"("organizationId", "externalRoomId", "messageId", "userId", "emoji");
CREATE INDEX "ConversationMessageReaction_organizationId_externalRoomId_idx" ON "ConversationMessageReaction"("organizationId", "externalRoomId");
ALTER TABLE "ConversationMessageReaction" ADD CONSTRAINT "ConversationMessageReaction_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+33
View File
@@ -213,6 +213,8 @@ model Organization {
conversationPinnedMessages ConversationPinnedMessage[]
conversationRoomUserPins ConversationRoomUserPin[]
conversationRoomMembers ConversationRoomMember[]
conversationRoomUserMutes ConversationRoomUserMute[]
conversationMessageReactions ConversationMessageReaction[]
}
model User {
@@ -2161,3 +2163,34 @@ model ConversationRoomMember {
@@unique([organizationId, externalRoomId, userId])
@@index([organizationId, externalRoomId])
}
/// بی‌صدا کردن گفتگو برای کاربر — با استثنای منشن
model ConversationRoomUserMute {
id String @id @default(cuid())
organizationId String
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
userId String
externalRoomId String
/// اگر true باشد منشن همچنان اعلان/خوانده‌نشده می‌سازد
allowMentions Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([organizationId, userId, externalRoomId])
@@index([organizationId, userId])
}
/// واکنش ایموجی روی پیام
model ConversationMessageReaction {
id String @id @default(cuid())
organizationId String
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
externalRoomId String
messageId String
emoji String
userId String
createdAt DateTime @default(now())
@@unique([organizationId, externalRoomId, messageId, userId, emoji])
@@index([organizationId, externalRoomId])
}