3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Fix bug in getRecentActionCount where the fn could return a boolean or reset the count during counting

This commit is contained in:
Dragory 2020-11-09 03:34:01 +02:00
parent d65f5b99d7
commit c9892936cd
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -7,12 +7,12 @@ export function getRecentActionCount(
userId: string,
actionGroupId: string,
since: number,
) {
): number {
return pluginData.state.recentActions.reduce((count, action) => {
if (action.timestamp < since) return count;
if (action.type !== type) return count;
if (action.actionGroupId !== actionGroupId) return count;
if (action.userId !== userId) return false;
if (action.userId !== userId) return count;
return count + action.count;
}, 0);
}