diff options
Diffstat (limited to 'server/models/utils.ts')
-rw-r--r-- | server/models/utils.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/models/utils.ts b/server/models/utils.ts index 1e168d419..3476799ce 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { literal, Op, OrderItem, Sequelize } from 'sequelize' | 1 | import { literal, Op, OrderItem, Sequelize } from 'sequelize' |
2 | import validator from 'validator' | 2 | import validator from 'validator' |
3 | import { forceNumber } from '@shared/core-utils' | ||
3 | 4 | ||
4 | type SortType = { sortModel: string, sortValue: string } | 5 | type SortType = { sortModel: string, sortValue: string } |
5 | 6 | ||
@@ -202,7 +203,7 @@ function buildBlockedAccountSQLOptimized (columnNameJoin: string, blockerIds: nu | |||
202 | } | 203 | } |
203 | 204 | ||
204 | function buildServerIdsFollowedBy (actorId: any) { | 205 | function buildServerIdsFollowedBy (actorId: any) { |
205 | const actorIdNumber = parseInt(actorId + '', 10) | 206 | const actorIdNumber = forceNumber(actorId) |
206 | 207 | ||
207 | return '(' + | 208 | return '(' + |
208 | 'SELECT "actor"."serverId" FROM "actorFollow" ' + | 209 | 'SELECT "actor"."serverId" FROM "actorFollow" ' + |
@@ -218,7 +219,7 @@ function buildWhereIdOrUUID (id: number | string) { | |||
218 | function parseAggregateResult (result: any) { | 219 | function parseAggregateResult (result: any) { |
219 | if (!result) return 0 | 220 | if (!result) return 0 |
220 | 221 | ||
221 | const total = parseInt(result + '', 10) | 222 | const total = forceNumber(result) |
222 | if (isNaN(total)) return 0 | 223 | if (isNaN(total)) return 0 |
223 | 224 | ||
224 | return total | 225 | return total |