Stop showing insight indicator for non-forks
This commit is contained in:
parent
5b391813b4
commit
d524348719
@ -44,7 +44,6 @@ export default async function AdminAppInsights() {
|
|||||||
const { isAiTextGenerationEnabled } = APP_CONFIGURATION;
|
const { isAiTextGenerationEnabled } = APP_CONFIGURATION;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
noFork,
|
|
||||||
forkBehind,
|
forkBehind,
|
||||||
noAiRateLimiting,
|
noAiRateLimiting,
|
||||||
outdatedPhotos,
|
outdatedPhotos,
|
||||||
@ -57,7 +56,7 @@ export default async function AdminAppInsights() {
|
|||||||
<AdminAppInsightsClient
|
<AdminAppInsightsClient
|
||||||
codeMeta={codeMeta}
|
codeMeta={codeMeta}
|
||||||
insights={{
|
insights={{
|
||||||
noFork,
|
noFork: !codeMeta?.isForkedFromBase && !codeMeta?.isBaseRepo,
|
||||||
forkBehind,
|
forkBehind,
|
||||||
noAi: !isAiTextGenerationEnabled,
|
noAi: !isAiTextGenerationEnabled,
|
||||||
noAiRateLimiting,
|
noAiRateLimiting,
|
||||||
|
|||||||
@ -9,30 +9,29 @@ import {
|
|||||||
import { getPhotosMeta } from '@/photo/db/query';
|
import { getPhotosMeta } from '@/photo/db/query';
|
||||||
import { OUTDATED_THRESHOLD } from '@/photo';
|
import { OUTDATED_THRESHOLD } from '@/photo';
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
export const getShouldShowInsightsIndicatorAction =
|
||||||
export const getShouldShowInsightsIndicatorAction = async (): Promise<InsightIndicatorStatus> =>
|
async (): Promise<InsightIndicatorStatus> =>
|
||||||
runAuthenticatedAdminServerAction(async () => {
|
runAuthenticatedAdminServerAction(async () => {
|
||||||
const [
|
const [
|
||||||
codeMeta,
|
codeMeta,
|
||||||
{ count: photosCountOutdated },
|
{ count: photosCountOutdated },
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
getGitHubMetaForCurrentApp(),
|
getGitHubMetaForCurrentApp(),
|
||||||
getPhotosMeta({ hidden: 'include', updatedBefore: OUTDATED_THRESHOLD }),
|
getPhotosMeta({ hidden: 'include', updatedBefore: OUTDATED_THRESHOLD }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
noFork,
|
forkBehind,
|
||||||
forkBehind,
|
noAiRateLimiting,
|
||||||
noAiRateLimiting,
|
outdatedPhotos,
|
||||||
outdatedPhotos,
|
} = getSignificantInsights({
|
||||||
} = getSignificantInsights({
|
codeMeta,
|
||||||
codeMeta,
|
photosCountOutdated,
|
||||||
photosCountOutdated,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
if (noAiRateLimiting || outdatedPhotos) {
|
if (noAiRateLimiting || outdatedPhotos) {
|
||||||
return 'yellow';
|
return 'yellow';
|
||||||
} else if (noFork || forkBehind) {
|
} else if (forkBehind) {
|
||||||
return 'blue';
|
return 'blue';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -69,7 +69,6 @@ export const getSignificantInsights = ({
|
|||||||
} = APP_CONFIGURATION;
|
} = APP_CONFIGURATION;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
noFork: !codeMeta?.isForkedFromBase && !codeMeta?.isBaseRepo,
|
|
||||||
forkBehind: Boolean(codeMeta?.isBehind),
|
forkBehind: Boolean(codeMeta?.isBehind),
|
||||||
noAiRateLimiting: isAiTextGenerationEnabled && !hasRedisStorage,
|
noAiRateLimiting: isAiTextGenerationEnabled && !hasRedisStorage,
|
||||||
outdatedPhotos: Boolean(photosCountOutdated),
|
outdatedPhotos: Boolean(photosCountOutdated),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user