Task #511: Fully remove Chat feature
Destructive removal per user confirmation ("حذف نهائي ما يرجع").
Removed:
- API: routes/conversations.ts, schema/conversations.ts, all chat
socket handlers in src/index.ts, /admin/users/:id/dependents/
conversations+messages endpoints, conversation/message dependency
counts in users/stats routes.
- Web: pages/chat.tsx, /chat route, dock chat filter, MessageSquare
icon and messages StatCard on home, all chat-related UI in
notifications + admin (dependency badges, delete-dialog rows,
UserDependentConversations/Messages sections, count map keys).
- Locales: nav.chat, home.stats.messages, full chat.* block,
admin.deleteUser conv/msgCount, admin.users.counts.conv/msg,
admin.audit.unit.conversation_*/message_*, admin.dependents.user*.
- OpenAPI spec: tags, all /conversations/* paths, conv/msg dependent
paths, related schemas (ConversationWithDetails, MessageWithSender,
UserDependentConversation/MessageItem+Page, etc.), UserProfile and
UserDeletionConflict conv/msg fields, HomeStats.unreadMessages.
Regenerated client via orval.
- Database: dropped message_reads, messages,
conversation_participants, conversations (CASCADE); deleted
notifications with related_type='conversation' or type='chat';
deleted apps row with slug='chat'; ran drizzle push-force.
- Seed: removed chat:access permission + user-role assignment +
seeded chat app entry from scripts/src/seed.ts.
- Tests: deleted conversations-leave.test.mjs; cleaned chat refs from
list-dependency-counts, delete-force-warnings, audit-log-coverage,
and admin-inline-dependency-counts (e2e) — replaced chat dependents
with note dependents where needed for force-delete coverage.
Notes preserved: notes.tsx noConversationsYet/conversationWith refer
to NOTE THREADS (not chat) and were intentionally NOT touched.
executive-meetings.ts not modified per replit.md restriction.
Pre-existing flaky test failures in executive-meetings/group/etc
suites remain unrelated to this task.
This commit is contained in:
@@ -138,10 +138,6 @@ after(async () => {
|
||||
}
|
||||
for (const uid of [adminId, ...createdUserIds]) {
|
||||
if (uid !== undefined) {
|
||||
await pool.query(`DELETE FROM messages WHERE sender_id = $1`, [uid]);
|
||||
await pool.query(`DELETE FROM conversations WHERE created_by = $1`, [
|
||||
uid,
|
||||
]);
|
||||
await pool.query(`DELETE FROM notes WHERE user_id = $1`, [uid]);
|
||||
await pool.query(`DELETE FROM service_orders WHERE user_id = $1`, [uid]);
|
||||
await pool.query(`DELETE FROM user_groups WHERE user_id = $1`, [uid]);
|
||||
@@ -187,15 +183,6 @@ test("DELETE /api/users/:id with dependents returns 409 with counts", async () =
|
||||
`INSERT INTO notes (user_id, title, content) VALUES ($1, 'Note A', 'x'), ($1, 'Note B', 'y')`,
|
||||
[uid],
|
||||
);
|
||||
const conv = await pool.query(
|
||||
`INSERT INTO conversations (created_by, name_en, is_group) VALUES ($1, 'Test Conv', true) RETURNING id`,
|
||||
[uid],
|
||||
);
|
||||
const convId = conv.rows[0].id;
|
||||
await pool.query(
|
||||
`INSERT INTO messages (conversation_id, sender_id, content) VALUES ($1, $2, 'hello')`,
|
||||
[convId, uid],
|
||||
);
|
||||
|
||||
const res = await fetch(`${API_BASE}/api/users/${uid}`, {
|
||||
method: "DELETE",
|
||||
@@ -204,8 +191,6 @@ test("DELETE /api/users/:id with dependents returns 409 with counts", async () =
|
||||
assert.equal(res.status, 409);
|
||||
const body = await res.json();
|
||||
assert.equal(body.noteCount, 2);
|
||||
assert.equal(body.conversationCount, 1);
|
||||
assert.equal(body.messageCount, 1);
|
||||
|
||||
const stillThere = await pool.query(`SELECT id FROM users WHERE id = $1`, [
|
||||
uid,
|
||||
@@ -225,14 +210,6 @@ test("DELETE /api/users/:id?force=true deletes user and writes audit log", async
|
||||
await pool.query(`INSERT INTO notes (user_id, title) VALUES ($1, 'n')`, [
|
||||
uid,
|
||||
]);
|
||||
const conv = await pool.query(
|
||||
`INSERT INTO conversations (created_by, name_en, is_group) VALUES ($1, 'Conv', true) RETURNING id`,
|
||||
[uid],
|
||||
);
|
||||
await pool.query(
|
||||
`INSERT INTO messages (conversation_id, sender_id, content) VALUES ($1, $2, 'hi')`,
|
||||
[conv.rows[0].id, uid],
|
||||
);
|
||||
|
||||
const res = await fetch(`${API_BASE}/api/users/${uid}?force=true`, {
|
||||
method: "DELETE",
|
||||
|
||||
Reference in New Issue
Block a user