fix: Use namePlural instead of labelPlural for favorite view URLs (#11407)

closes #11404

Used `namePlural` instead of `labelPlural` for generating favorite view
URLs to ensure proper routing across all languages.
This commit is contained in:
nitin
2025-04-07 12:24:43 +05:30
committed by GitHub
parent f365caa365
commit a627eff5c2
2 changed files with 8 additions and 8 deletions

View File

@ -3,11 +3,11 @@ import { View } from '@/views/types/View';
import { isDefined } from 'twenty-shared/utils'; import { isDefined } from 'twenty-shared/utils';
type ReturnType = { type ReturnType = {
labelPlural: string; namePlural: string;
view: Pick<View, 'id' | 'name' | 'objectMetadataId'>; view: Pick<View, 'id' | 'name' | 'objectMetadataId'>;
}; };
export const getObjectMetadataLabelPluralFromViewId = ( export const getObjectMetadataNamePluralFromViewId = (
view: Pick<View, 'id' | 'name' | 'objectMetadataId'>, view: Pick<View, 'id' | 'name' | 'objectMetadataId'>,
objectMetadataItems: ObjectMetadataItem[], objectMetadataItems: ObjectMetadataItem[],
): ReturnType => { ): ReturnType => {
@ -21,10 +21,10 @@ export const getObjectMetadataLabelPluralFromViewId = (
); );
} }
const { labelPlural } = objectMetadataItem; const { namePlural } = objectMetadataItem;
return { return {
labelPlural, namePlural,
view, view,
}; };
}; };

View File

@ -1,13 +1,13 @@
import { Favorite } from '@/favorites/types/Favorite'; import { Favorite } from '@/favorites/types/Favorite';
import { getObjectMetadataNamePluralFromViewId } from '@/favorites/utils/getObjectMetadataNamePluralFromViewId';
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { ObjectRecord } from '@/object-record/types/ObjectRecord'; import { ObjectRecord } from '@/object-record/types/ObjectRecord';
import { ObjectRecordIdentifier } from '@/object-record/types/ObjectRecordIdentifier'; import { ObjectRecordIdentifier } from '@/object-record/types/ObjectRecordIdentifier';
import { AppPath } from '@/types/AppPath'; import { AppPath } from '@/types/AppPath';
import { View } from '@/views/types/View'; import { View } from '@/views/types/View';
import { getAppPath } from '~/utils/navigation/getAppPath';
import { getObjectMetadataLabelPluralFromViewId } from './getObjectMetadataLabelPluralFromViewId';
import { isDefined } from 'twenty-shared/utils'; import { isDefined } from 'twenty-shared/utils';
import { getAppPath } from '~/utils/navigation/getAppPath';
export type ProcessedFavorite = Favorite & { export type ProcessedFavorite = Favorite & {
Icon?: string; Icon?: string;
@ -39,7 +39,7 @@ export const sortFavorites = (
} as ProcessedFavorite; } as ProcessedFavorite;
} }
const { labelPlural } = getObjectMetadataLabelPluralFromViewId( const { namePlural } = getObjectMetadataNamePluralFromViewId(
view, view,
objectMetadataItems, objectMetadataItems,
); );
@ -54,7 +54,7 @@ export const sortFavorites = (
labelIdentifier: view?.name, labelIdentifier: view?.name,
link: getAppPath( link: getAppPath(
AppPath.RecordIndexPage, AppPath.RecordIndexPage,
{ objectNamePlural: labelPlural.toLowerCase() }, { objectNamePlural: namePlural },
favorite.viewId ? { viewId: favorite.viewId } : undefined, favorite.viewId ? { viewId: favorite.viewId } : undefined,
), ),
forWorkspaceMemberId: favorite.forWorkspaceMemberId, forWorkspaceMemberId: favorite.forWorkspaceMemberId,