Stop showing insight indicator for non-forks

This commit is contained in:
Sam Becker 2025-02-17 22:48:42 -06:00
parent 5b391813b4
commit d524348719
3 changed files with 26 additions and 29 deletions

View File

@ -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() {
<AdminAppInsightsClient
codeMeta={codeMeta}
insights={{
noFork,
noFork: !codeMeta?.isForkedFromBase && !codeMeta?.isBaseRepo,
forkBehind,
noAi: !isAiTextGenerationEnabled,
noAiRateLimiting,

View File

@ -9,30 +9,29 @@ import {
import { getPhotosMeta } from '@/photo/db/query';
import { OUTDATED_THRESHOLD } from '@/photo';
// eslint-disable-next-line max-len
export const getShouldShowInsightsIndicatorAction = async (): Promise<InsightIndicatorStatus> =>
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<InsightIndicatorStatus> =>
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';
}
});

View File

@ -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),