DRY up the message receive timing validation

This commit is contained in:
Josh Perez 2023-09-12 16:12:07 -04:00 committed by GitHub
parent 7ea945c157
commit 944a70abe7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 27 deletions

View file

@ -134,7 +134,6 @@ import type { SendTypesType } from '../util/handleMessageSend';
import { getStoriesBlocked } from '../util/stories';
import { isNotNil } from '../util/isNotNil';
import { chunk } from '../util/iterables';
import { isOlderThan } from '../util/timestamp';
import { inspectUnknownFieldTags } from '../util/inspectProtobufs';
import { incrementMessageCounter } from '../util/incrementMessageCounter';
import { filterAndClean } from '../types/BodyRange';
@ -2389,17 +2388,6 @@ export default class MessageReceiver
return;
}
// Timing check
if (isOlderThan(envelope.serverTimestamp, durations.DAY * 2)) {
log.info(
'MessageReceiver.handleEditMessage: cannot edit message older than 48h',
logId,
envelope.serverTimestamp
);
this.removeFromCache(envelope);
return;
}
const message = this.processDecrypted(envelope, msg.dataMessage);
const groupId = this.getProcessedGroupId(message);
const isBlocked = groupId ? this.isGroupBlocked(groupId) : false;