Page MenuHomePhabricator

D11904.id39962.diff
No OneTemporary

D11904.id39962.diff

diff --git a/keyserver/src/creators/thread-creator.js b/keyserver/src/creators/thread-creator.js
--- a/keyserver/src/creators/thread-creator.js
+++ b/keyserver/src/creators/thread-creator.js
@@ -323,12 +323,26 @@
}
} else {
const query = SQL`
+ START TRANSACTION;
+
INSERT INTO threads(id, type, name, description, creator, creation_time,
color, parent_thread_id, containing_thread_id, community, depth,
source_message)
- VALUES ${[row]}
+ VALUES ${[row]};
`;
- await dbQuery(query);
+
+ if (threadTypeIsCommunityRoot(threadType)) {
+ query.append(SQL`
+ INSERT INTO communities (id)
+ VALUES (${id});
+ `);
+ }
+
+ query.append(SQL`
+ COMMIT;
+ `);
+
+ await dbQuery(query, { multipleStatements: true });
}
const initialMemberPromise: Promise<?MembershipChangeset> = initialMemberIDs
diff --git a/keyserver/src/deleters/thread-deleters.js b/keyserver/src/deleters/thread-deleters.js
--- a/keyserver/src/deleters/thread-deleters.js
+++ b/keyserver/src/deleters/thread-deleters.js
@@ -95,6 +95,7 @@
const deletionQuery = SQL`
START TRANSACTION;
DELETE FROM threads WHERE id IN (${threadIDs});
+ DELETE FROM communities WHERE id IN (${threadIDs});
DELETE FROM ids WHERE id IN (${threadIDs});
DELETE d, id, e, ie, r, ir
FROM days d

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 12:18 PM (21 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2537725
Default Alt Text
D11904.id39962.diff (1 KB)

Event Timeline