Page MenuHomePhabricator

D5803.id19258.diff
No OneTemporary

D5803.id19258.diff

diff --git a/keyserver/src/fetchers/message-fetchers.js b/keyserver/src/fetchers/message-fetchers.js
--- a/keyserver/src/fetchers/message-fetchers.js
+++ b/keyserver/src/fetchers/message-fetchers.js
@@ -280,8 +280,9 @@
const viewerID = viewer.id;
const query = SQL`
WITH thread_window AS (
- SELECT m.id, m.thread AS threadID, m.user AS creatorID, m.content,
- m.time, m.type, m.creation, stm.permissions AS subthread_permissions,
+ SELECT m.id, m.thread AS threadID, m.user AS creatorID,
+ m.target_message as targetMessageID, m.content, m.time, m.type,
+ m.creation, stm.permissions AS subthread_permissions,
ROW_NUMBER() OVER (
PARTITION BY threadID ORDER BY m.time DESC, m.id DESC
) n
@@ -505,9 +506,9 @@
const viewerID = viewer.id;
const query = SQL`
SELECT m.id, m.thread AS threadID, m.content, m.time, m.type,
- m.creation, m.user AS creatorID, stm.permissions AS subthread_permissions,
- up.id AS uploadID, up.type AS uploadType, up.secret AS uploadSecret,
- up.extra AS uploadExtra
+ m.creation, m.user AS creatorID, m.target_message as targetMessageID,
+ stm.permissions AS subthread_permissions, up.id AS uploadID,
+ up.type AS uploadType, up.secret AS uploadSecret, up.extra AS uploadExtra
FROM messages m
LEFT JOIN uploads up ON up.container = m.id
LEFT JOIN memberships mm ON mm.thread = m.thread AND mm.user = ${viewerID}
@@ -587,9 +588,9 @@
const viewerID = viewer.id;
const query = SQL`
SELECT m.id, m.thread AS threadID, m.content, m.time, m.type, m.creation,
- m.user AS creatorID, stm.permissions AS subthread_permissions,
- up.id AS uploadID, up.type AS uploadType, up.secret AS uploadSecret,
- up.extra AS uploadExtra
+ m.user AS creatorID, m.target_message as targetMessageID,
+ stm.permissions AS subthread_permissions, up.id AS uploadID,
+ up.type AS uploadType, up.secret AS uploadSecret, up.extra AS uploadExtra
FROM messages m
LEFT JOIN uploads up ON up.container = m.id
LEFT JOIN memberships mm ON mm.thread = m.thread AND mm.user = ${viewerID}
@@ -617,8 +618,9 @@
const viewerID = viewer.id;
const query = SQL`
SELECT m.id, m.thread AS threadID, m.content, m.time, m.type, m.creation,
- m.user AS creatorID, up.id AS uploadID, up.type AS uploadType,
- up.secret AS uploadSecret, up.extra AS uploadExtra
+ m.user AS creatorID, m.target_message as targetMessageID,
+ up.id AS uploadID, up.type AS uploadType, up.secret AS uploadSecret,
+ up.extra AS uploadExtra
FROM messages m
LEFT JOIN uploads up ON up.container = m.id
LEFT JOIN memberships mm ON mm.thread = m.thread AND mm.user = ${viewerID}
@@ -639,9 +641,9 @@
async function fetchMessageRowsByIDs(messageIDs: $ReadOnlyArray<string>) {
const query = SQL`
SELECT m.id, m.thread AS threadID, m.content, m.time, m.type, m.creation,
- m.user AS creatorID, stm.permissions AS subthread_permissions,
- up.id AS uploadID, up.type AS uploadType, up.secret AS uploadSecret,
- up.extra AS uploadExtra
+ m.user AS creatorID, m.target_message as targetMessageID,
+ stm.permissions AS subthread_permissions, up.id AS uploadID,
+ up.type AS uploadType, up.secret AS uploadSecret, up.extra AS uploadExtra
FROM messages m
LEFT JOIN uploads up ON up.container = m.id
LEFT JOIN memberships stm ON m.type = ${messageTypes.CREATE_SUB_THREAD}
diff --git a/lib/shared/messages/reaction-message-spec.js b/lib/shared/messages/reaction-message-spec.js
--- a/lib/shared/messages/reaction-message-spec.js
+++ b/lib/shared/messages/reaction-message-spec.js
@@ -51,6 +51,26 @@
return messagePreviewText(validMessageInfo, threadInfo);
},
+ rawMessageInfoFromServerDBRow(row: Object): RawReactionMessageInfo {
+ invariant(
+ row.targetMessageID !== null && row.targetMessageID !== undefined,
+ 'targetMessageID should be set on server',
+ );
+
+ const content = JSON.parse(row.content);
+
+ return {
+ type: messageTypes.REACTION,
+ id: row.id.toString(),
+ threadID: row.threadID.toString(),
+ time: row.time,
+ creatorID: row.creatorID.toString(),
+ targetMessageID: row.targetMessageID.toString(),
+ reaction: content.reaction,
+ action: content.action,
+ };
+ },
+
rawMessageInfoFromClientDB(
clientDBMessageInfo: ClientDBMessageInfo,
): RawReactionMessageInfo {

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 12:55 AM (20 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595312
Default Alt Text
D5803.id19258.diff (4 KB)

Event Timeline