3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-20 00:05:04 +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 d5f1bff75b
commit 7f044e24e9

View file

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