Skip to content

Commit 9849ac0

Browse files
authored
fix: improve turbo status handling for spaces (#1010)
### Summary - updated isTurbo function to accept boolean for turbo status ### How to test - use following query to see correct space order sorted by popularity ```GraphQL { ranking(first:10){ items { id rank } } } ```
1 parent a82387e commit 9849ac0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/helpers/spaces.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ type Metadata = {
5656
pluginNames: string[];
5757
};
5858

59-
function isTurbo(turbo: number, turboExpiration: number): boolean {
60-
return turbo === 1 || turboExpiration > Date.now() / 1e3;
59+
function isTurbo(turbo: boolean, turboExpiration: number): boolean {
60+
return turbo || turboExpiration > Date.now() / 1e3;
6161
}
6262

6363
function getPopularity(space: Metadata): number {
@@ -174,7 +174,7 @@ async function loadSpaces() {
174174
...JSON.parse(space.settings),
175175
flagged: space.flagged === 1,
176176
verified: space.verified === 1,
177-
turbo: isTurbo(space.turbo, space.turbo_expiration),
177+
turbo: isTurbo(!!space.turbo, space.turbo_expiration),
178178
turboExpiration: space.turbo_expiration,
179179
hibernated: space.hibernated === 1,
180180
follower_count: space.follower_count,
@@ -321,7 +321,7 @@ export async function getSpace(id: string) {
321321
domain: space.domain,
322322
flagged: space.flagged === 1,
323323
verified: space.verified === 1,
324-
turbo: isTurbo(space.turbo, space.turbo_expiration),
324+
turbo: isTurbo(!!space.turbo, space.turbo_expiration),
325325
turboExpiration: space.turbo_expiration,
326326
hibernated: space.hibernated === 1,
327327
deleted: space.deleted === 1

0 commit comments

Comments
 (0)