Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3524358
D7145.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7145.diff
View Options
diff --git a/keyserver/src/responders/message-responders.js b/keyserver/src/responders/message-responders.js
--- a/keyserver/src/responders/message-responders.js
+++ b/keyserver/src/responders/message-responders.js
@@ -27,6 +27,7 @@
import type { TextMessageData } from 'lib/types/messages/text.js';
import { threadPermissions } from 'lib/types/thread-types.js';
import { ServerError } from 'lib/utils/errors.js';
+import { values } from 'lib/utils/objects.js';
import {
tRegex,
tShape,
@@ -316,10 +317,15 @@
}
const { threadID } = targetMessageInfo;
- const [serverThreadInfos, hasPermission] = await Promise.all([
- fetchServerThreadInfos(SQL`t.id = ${threadID}`),
- checkThreadPermission(viewer, threadID, threadPermissions.EDIT_MESSAGE),
- ]);
+
+ const [serverThreadInfos, hasPermission, rawSidebarThreadInfos] =
+ await Promise.all([
+ fetchServerThreadInfos(SQL`t.id = ${threadID}`),
+ checkThreadPermission(viewer, threadID, threadPermissions.EDIT_MESSAGE),
+ fetchServerThreadInfos(
+ SQL`t.parent_thread_id = ${threadID} AND t.source_message = ${targetMessageID}`,
+ ),
+ ]);
const targetMessageThreadInfo = serverThreadInfos.threadInfos[threadID];
if (targetMessageThreadInfo.sourceMessageID === targetMessageID) {
@@ -336,17 +342,33 @@
throw new ServerError('invalid_parameters');
}
+ const time = Date.now();
const messagesData = [];
- const messageData: EditMessageData = {
+ let messageData: EditMessageData = {
type: messageTypes.EDIT_MESSAGE,
threadID,
creatorID: viewer.id,
- time: Date.now(),
+ time,
targetMessageID,
text,
};
messagesData.push(messageData);
+ const sidebarThreadValues = values(rawSidebarThreadInfos.threadInfos);
+ for (const sidebarThreadValue of sidebarThreadValues) {
+ if (sidebarThreadValue && sidebarThreadValue.id) {
+ messageData = {
+ type: messageTypes.EDIT_MESSAGE,
+ threadID: sidebarThreadValue.id,
+ creatorID: viewer.id,
+ time,
+ targetMessageID,
+ text: text,
+ };
+ messagesData.push(messageData);
+ }
+ }
+
const newMessageInfos = await createMessages(viewer, messagesData);
return { newMessageInfos };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 12:24 PM (17 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2699983
Default Alt Text
D7145.diff (2 KB)
Attached To
Mode
D7145: [keyserver] Adding edit_message to the sidebar thread
Attached
Detach File
Event Timeline
Log In to Comment