From d524348719b701d519e405059303c38a3d22906e Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Mon, 17 Feb 2025 22:48:42 -0600 Subject: [PATCH] Stop showing insight indicator for non-forks --- src/admin/insights/AdminAppInsights.tsx | 3 +- src/admin/insights/actions.ts | 51 ++++++++++++------------- src/admin/insights/index.ts | 1 - 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/admin/insights/AdminAppInsights.tsx b/src/admin/insights/AdminAppInsights.tsx index db92e2fd..c1db6dc9 100644 --- a/src/admin/insights/AdminAppInsights.tsx +++ b/src/admin/insights/AdminAppInsights.tsx @@ -44,7 +44,6 @@ export default async function AdminAppInsights() { const { isAiTextGenerationEnabled } = APP_CONFIGURATION; const { - noFork, forkBehind, noAiRateLimiting, outdatedPhotos, @@ -57,7 +56,7 @@ export default async function AdminAppInsights() { => - runAuthenticatedAdminServerAction(async () => { - const [ - codeMeta, - { count: photosCountOutdated }, - ] = await Promise.all([ - getGitHubMetaForCurrentApp(), - getPhotosMeta({ hidden: 'include', updatedBefore: OUTDATED_THRESHOLD }), - ]); - - const { - noFork, - forkBehind, - noAiRateLimiting, - outdatedPhotos, - } = getSignificantInsights({ - codeMeta, - photosCountOutdated, - }); +export const getShouldShowInsightsIndicatorAction = + async (): Promise => + runAuthenticatedAdminServerAction(async () => { + const [ + codeMeta, + { count: photosCountOutdated }, + ] = await Promise.all([ + getGitHubMetaForCurrentApp(), + getPhotosMeta({ hidden: 'include', updatedBefore: OUTDATED_THRESHOLD }), + ]); + + const { + forkBehind, + noAiRateLimiting, + outdatedPhotos, + } = getSignificantInsights({ + codeMeta, + photosCountOutdated, + }); - if (noAiRateLimiting || outdatedPhotos) { - return 'yellow'; - } else if (noFork || forkBehind) { - return 'blue'; - } - }); + if (noAiRateLimiting || outdatedPhotos) { + return 'yellow'; + } else if (forkBehind) { + return 'blue'; + } + }); diff --git a/src/admin/insights/index.ts b/src/admin/insights/index.ts index 0514fc9c..a1459a9b 100644 --- a/src/admin/insights/index.ts +++ b/src/admin/insights/index.ts @@ -69,7 +69,6 @@ export const getSignificantInsights = ({ } = APP_CONFIGURATION; return { - noFork: !codeMeta?.isForkedFromBase && !codeMeta?.isBaseRepo, forkBehind: Boolean(codeMeta?.isBehind), noAiRateLimiting: isAiTextGenerationEnabled && !hasRedisStorage, outdatedPhotos: Boolean(photosCountOutdated),