Page MenuHomePhabricator

D3354.diff
No OneTemporary

D3354.diff

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
@@ -8,6 +8,7 @@
} from 'lib/shared/message-utils';
import { messageSpecs } from 'lib/shared/messages/message-specs';
import { notifCollapseKeyForRawMessageInfo } from 'lib/shared/notif-utils';
+import { hasMinCodeVersion } from 'lib/shared/version-utils';
import {
type RawMessageInfo,
type RawComposableMessageInfo,
@@ -254,7 +255,7 @@
criteria: MessageSelectionCriteria,
numberPerThread: number,
): Promise<FetchMessageInfosResult> {
- const selectionClause = messageSelectionCriteriaToSQLClause(criteria);
+ const selectionClause = messageSelectionCriteriaToSQLClause(viewer, criteria);
const truncationStatuses = {};
const viewerID = viewer.id;
@@ -352,19 +353,25 @@
}
function messageSelectionCriteriaToSQLClause(
+ viewer: Viewer,
criteria: MessageSelectionCriteria,
) {
const minMessageTime = Date.now() - defaultMaxMessageAge;
+ const shouldApplyTimeFilter = hasMinCodeVersion(viewer.platformDetails, 130);
let globalTimeFilter;
if (criteria.newerThan) {
globalTimeFilter = SQL`m.time > ${criteria.newerThan}`;
- } else if (!criteria.threadCursors) {
+ } else if (!criteria.threadCursors && shouldApplyTimeFilter) {
globalTimeFilter = SQL`m.time > ${minMessageTime}`;
}
const threadConditions = [];
- if (criteria.joinedThreads === true && !globalTimeFilter) {
+ if (
+ criteria.joinedThreads === true &&
+ shouldApplyTimeFilter &&
+ !globalTimeFilter
+ ) {
threadConditions.push(SQL`(mm.role > 0 AND m.time > ${minMessageTime})`);
} else if (criteria.joinedThreads === true) {
threadConditions.push(SQL`mm.role > 0`);
@@ -408,7 +415,7 @@
criteria: MessageSelectionCriteria,
maxNumberPerThread: number,
): Promise<FetchMessageInfosResult> {
- const selectionClause = messageSelectionCriteriaToSQLClause(criteria);
+ const selectionClause = messageSelectionCriteriaToSQLClause(viewer, criteria);
const truncationStatuses = messageSelectionCriteriaToInitialTruncationStatuses(
criteria,
messageTruncationStatus.UNCHANGED,

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 10:58 AM (20 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2534833
Default Alt Text
D3354.diff (2 KB)

Event Timeline