mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
Fix bug in getRecentActionCount where the fn could return a boolean or reset the count during counting
This commit is contained in:
parent
d65f5b99d7
commit
c9892936cd
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue