Page MenuHomePhorge

D3347.1768787794.diff
No OneTemporary

Size
7 KB
Referenced Files
None
Subscribers
None

D3347.1768787794.diff

diff --git a/lib/types/message-types.js b/lib/types/message-types.js
--- a/lib/types/message-types.js
+++ b/lib/types/message-types.js
@@ -407,7 +407,7 @@
// 1) getMessageInfosSince: Result set for thread is equal to max, and the
// truncation status isn't EXHAUSTIVE (ie. doesn't include the very first
// message).
- // 2) getMessageInfos: ThreadSelectionCriteria does not specify cursors, the
+ // 2) getMessageInfos: MessageSelectionCriteria does not specify cursors, the
// result set for thread is equal to max, and the truncation status isn't
// EXHAUSTIVE. If cursors are specified, we never return truncated, since
// the cursor given us guarantees the contiguousness of the result set.
@@ -438,7 +438,7 @@
export type ThreadCursors = { +[threadID: string]: ?string };
-export type ThreadSelectionCriteria = {
+export type MessageSelectionCriteria = {
+threadCursors?: ?ThreadCursors,
+joinedThreads?: ?boolean,
};
diff --git a/server/src/creators/update-creator.js b/server/src/creators/update-creator.js
--- a/server/src/creators/update-creator.js
+++ b/server/src/creators/update-creator.js
@@ -458,13 +458,13 @@
calendarQuery = defaultCalendarQuery(viewer.platform, viewer.timeZone);
}
if (threadIDsNeedingDetailedFetch.size > 0) {
- const threadSelectionCriteria = { threadCursors: {} };
+ const messageSelectionCriteria = { threadCursors: {} };
for (const threadID of threadIDsNeedingDetailedFetch) {
- threadSelectionCriteria.threadCursors[threadID] = false;
+ messageSelectionCriteria.threadCursors[threadID] = false;
}
promises.messageInfosResult = fetchMessageInfos(
viewer,
- threadSelectionCriteria,
+ messageSelectionCriteria,
defaultNumberPerThread,
);
const threadCalendarQuery = {
diff --git a/server/src/fetchers/message-fetchers.js b/server/src/fetchers/message-fetchers.js
--- a/server/src/fetchers/message-fetchers.js
+++ b/server/src/fetchers/message-fetchers.js
@@ -15,7 +15,7 @@
messageTypes,
type MessageType,
assertMessageType,
- type ThreadSelectionCriteria,
+ type MessageSelectionCriteria,
type MessageTruncationStatus,
messageTruncationStatus,
type FetchMessageInfosResult,
@@ -245,10 +245,10 @@
async function fetchMessageInfos(
viewer: Viewer,
- criteria: ThreadSelectionCriteria,
+ criteria: MessageSelectionCriteria,
numberPerThread: number,
): Promise<FetchMessageInfosResult> {
- const threadSelectionClause = threadSelectionCriteriaToSQLClause(criteria);
+ const selectionClause = messageSelectionCriteriaToSQLClause(criteria);
const truncationStatuses = {};
const viewerID = viewer.id;
@@ -280,7 +280,7 @@
AND stm.thread = m.content AND stm.user = ${viewerID}
WHERE JSON_EXTRACT(mm.permissions, ${visibleExtractString}) IS TRUE AND
`;
- query.append(threadSelectionClause);
+ query.append(selectionClause);
query.append(SQL`
ORDER BY m.thread, m.time DESC
) x
@@ -345,7 +345,9 @@
};
}
-function threadSelectionCriteriaToSQLClause(criteria: ThreadSelectionCriteria) {
+function messageSelectionCriteriaToSQLClause(
+ criteria: MessageSelectionCriteria,
+) {
const conditions = [];
if (criteria.joinedThreads === true) {
conditions.push(SQL`mm.role > 0`);
@@ -366,8 +368,8 @@
return mergeOrConditions(conditions);
}
-function threadSelectionCriteriaToInitialTruncationStatuses(
- criteria: ThreadSelectionCriteria,
+function messageSelectionCriteriaToInitialTruncationStatuses(
+ criteria: MessageSelectionCriteria,
defaultTruncationStatus: MessageTruncationStatus,
) {
const truncationStatuses = {};
@@ -381,12 +383,12 @@
async function fetchMessageInfosSince(
viewer: Viewer,
- criteria: ThreadSelectionCriteria,
+ criteria: MessageSelectionCriteria,
currentAsOf: number,
maxNumberPerThread: number,
): Promise<FetchMessageInfosResult> {
- const threadSelectionClause = threadSelectionCriteriaToSQLClause(criteria);
- const truncationStatuses = threadSelectionCriteriaToInitialTruncationStatuses(
+ const selectionClause = messageSelectionCriteriaToSQLClause(criteria);
+ const truncationStatuses = messageSelectionCriteriaToInitialTruncationStatuses(
criteria,
messageTruncationStatus.UNCHANGED,
);
@@ -407,7 +409,7 @@
WHERE m.time > ${currentAsOf} AND
JSON_EXTRACT(mm.permissions, ${visibleExtractString}) IS TRUE AND
`;
- query.append(threadSelectionClause);
+ query.append(selectionClause);
query.append(SQL`
ORDER BY m.thread, m.time DESC
`);
diff --git a/server/src/responders/user-responders.js b/server/src/responders/user-responders.js
--- a/server/src/responders/user-responders.js
+++ b/server/src/responders/user-responders.js
@@ -252,7 +252,7 @@
for (const watchedThreadID of request.watchedIDs) {
threadCursors[watchedThreadID] = null;
}
- const threadSelectionCriteria = { threadCursors, joinedThreads: true };
+ const messageSelectionCriteria = { threadCursors, joinedThreads: true };
const [
threadsResult,
@@ -262,7 +262,7 @@
currentUserInfo,
] = await Promise.all([
fetchThreadInfos(viewer),
- fetchMessageInfos(viewer, threadSelectionCriteria, defaultNumberPerThread),
+ fetchMessageInfos(viewer, messageSelectionCriteria, defaultNumberPerThread),
calendarQuery ? fetchEntryInfos(viewer, [calendarQuery]) : undefined,
fetchKnownUserInfos(viewer),
fetchLoggedInUserInfo(viewer),
diff --git a/server/src/responders/website-responders.js b/server/src/responders/website-responders.js
--- a/server/src/responders/website-responders.js
+++ b/server/src/responders/website-responders.js
@@ -132,14 +132,14 @@
endDate: initialNavInfo.endDate,
filters: defaultCalendarFilters,
};
- const threadSelectionCriteria = { joinedThreads: true };
+ const messageSelectionCriteria = { joinedThreads: true };
const initialTime = Date.now();
const assetInfoPromise = getAssetInfo();
const threadInfoPromise = fetchThreadInfos(viewer);
const messageInfoPromise = fetchMessageInfos(
viewer,
- threadSelectionCriteria,
+ messageSelectionCriteria,
defaultNumberPerThread,
);
const entryInfoPromise = fetchEntryInfos(viewer, [calendarQuery]);
diff --git a/server/src/socket/socket.js b/server/src/socket/socket.js
--- a/server/src/socket/socket.js
+++ b/server/src/socket/socket.js
@@ -426,14 +426,14 @@
for (const watchedThreadID of watchedIDs) {
threadCursors[watchedThreadID] = null;
}
- const threadSelectionCriteria = { threadCursors, joinedThreads: true };
+ const messageSelectionCriteria = { threadCursors, joinedThreads: true };
const [
fetchMessagesResult,
{ serverRequests, activityUpdateResult },
] = await Promise.all([
fetchMessageInfosSince(
viewer,
- threadSelectionCriteria,
+ messageSelectionCriteria,
oldMessagesCurrentAsOf,
defaultNumberPerThread,
),
diff --git a/server/src/updaters/thread-updaters.js b/server/src/updaters/thread-updaters.js
--- a/server/src/updaters/thread-updaters.js
+++ b/server/src/updaters/thread-updaters.js
@@ -773,7 +773,7 @@
};
const newMessages = await createMessages(viewer, [messageData]);
- const threadSelectionCriteria = {
+ const messageSelectionCriteria = {
threadCursors: { [request.threadID]: false },
};
@@ -789,7 +789,7 @@
}
const [fetchMessagesResult, fetchEntriesResult] = await Promise.all([
- fetchMessageInfos(viewer, threadSelectionCriteria, defaultNumberPerThread),
+ fetchMessageInfos(viewer, messageSelectionCriteria, defaultNumberPerThread),
calendarQuery ? fetchEntryInfos(viewer, [calendarQuery]) : undefined,
]);
const rawEntryInfos = fetchEntriesResult && fetchEntriesResult.rawEntryInfos;

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 19, 1:56 AM (7 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5952919
Default Alt Text
D3347.1768787794.diff (7 KB)

Event Timeline