1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00

Merge pull request #1172 from matrix-org/bwindels/reduceveriflogging

Don't log verification validation errors for normal messages
This commit is contained in:
J. Ryan Stinnett
2020-01-27 15:04:00 +00:00
committed by GitHub
2 changed files with 10 additions and 6 deletions

View File

@@ -128,11 +128,13 @@ export class InRoomChannel {
static validateEvent(event, client) {
const txnId = InRoomChannel.getTransactionId(event);
if (typeof txnId !== "string" || txnId.length === 0) {
logger.log("InRoomChannel: validateEvent: no valid txnId " + txnId);
return false;
}
const type = InRoomChannel.getEventType(event);
const content = event.getContent();
// from here on we're fairly sure that this is supposed to be
// part of a verification request, so be noisy when rejecting something
if (type === REQUEST_TYPE) {
if (!content || typeof content.to !== "string" || !content.to.length) {
logger.log("InRoomChannel: validateEvent: " +

View File

@@ -84,13 +84,15 @@ export class VerificationRequest extends EventEmitter {
static validateEvent(type, event, client) {
const content = event.getContent();
if (!content) {
logger.log("VerificationRequest: validateEvent: no content");
}
if (!type.startsWith(EVENT_PREFIX)) {
logger.log("VerificationRequest: validateEvent: " +
"fail because type doesnt start with " + EVENT_PREFIX);
return false;
}
// from here on we're fairly sure that this is supposed to be
// part of a verification request, so be noisy when rejecting something
if (!content) {
logger.log("VerificationRequest: validateEvent: no content");
return false;
}