fix(spam): recent actions being considered from all users, not just the author of the message being evaluated

This commit is contained in:
Miikka 2018-08-03 11:23:08 +03:00 committed by GitHub
parent 96a9a189e0
commit 01a1f4cbe3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,6 +90,7 @@ export class SpamPlugin extends Plugin {
if (action.timestamp < since) return false; if (action.timestamp < since) return false;
if (action.type !== type) return false; if (action.type !== type) return false;
if (action.channelId !== channelId) return false; if (action.channelId !== channelId) return false;
if (action.userId !== userId) return false;
return true; return true;
}); });
} }
@ -99,6 +100,7 @@ export class SpamPlugin extends Plugin {
if (action.timestamp < since) return count; if (action.timestamp < since) return count;
if (action.type !== type) return count; if (action.type !== type) return count;
if (action.channelId !== channelId) return count; if (action.channelId !== channelId) return count;
if (action.userId !== userId) return false;
return count + action.count; return count + action.count;
}, 0); }, 0);
} }