merge: bring latest origin/main into dev (main wins conflicts)
This commit is contained in:
@@ -15,15 +15,11 @@ import GamificationToaster from '@/components/gamification/GamificationToaster.v
|
||||
import SmsHeaderWallet from '@/components/SmsHeaderWallet.vue';
|
||||
import { NAV_HUBS, type NavHubDef, type NavHubKey } from '@/lib/nav-hubs';
|
||||
import {
|
||||
brand,
|
||||
type ActivitySummaryDto,
|
||||
type AuthUserDto,
|
||||
type NotificationDto,
|
||||
type NotificationsListDto,
|
||||
type OrgUserDto,
|
||||
} from '@mento/shared';
|
||||
import { USER_ROLE_LABELS, canManageSettings, canViewAllRecords } from '@/lib/roles';
|
||||
import { hasSectionPermission, sectionPermissionForPath } from '@/lib/section-permissions';
|
||||
canOpenPath,
|
||||
firstAllowedFinancePath,
|
||||
hasSectionPermission,
|
||||
sectionPermissionForPath,
|
||||
} from '@/lib/section-permissions';
|
||||
import { refreshUnreadTotal, useOrgChat } from '@/lib/useOrgChat';
|
||||
|
||||
const auth = useAuthStore();
|
||||
@@ -198,12 +194,11 @@ function cardAllowedForNav(card: {
|
||||
}) {
|
||||
if (card.ownerOnly && auth.user?.role !== 'owner') return false;
|
||||
const perms = auth.user?.permissions ?? [];
|
||||
const canTreasury = auth.user?.role === 'owner'
|
||||
|| auth.user?.role === 'admin'
|
||||
|| perms.includes('treasury')
|
||||
|| perms.some((key) => key.startsWith('treasury_'));
|
||||
if (card.to?.startsWith('/finance')) {
|
||||
return moduleAllowed(card.module ?? 'treasury') && canTreasury;
|
||||
return (
|
||||
moduleAllowed(card.module ?? 'treasury')
|
||||
&& Boolean(firstAllowedFinancePath(auth.user?.role, perms))
|
||||
);
|
||||
}
|
||||
const section = card.to ? sectionPermissionForPath(card.to) : null;
|
||||
const hasSection = section
|
||||
@@ -240,7 +235,13 @@ const openHub = computed<NavHubDef | null>(() => {
|
||||
if (!openHubKey.value) return null;
|
||||
const hub = NAV_HUBS.find((item) => item.key === openHubKey.value);
|
||||
if (!hub) return null;
|
||||
const cards = hub.cards.filter((card) => cardAllowedForNav(card));
|
||||
const financeTo = firstAllowedFinancePath(auth.user?.role, auth.user?.permissions);
|
||||
const cards = hub.cards
|
||||
.filter((card) => cardAllowedForNav(card))
|
||||
.map((card) => {
|
||||
if (!financeTo || !card.to.startsWith('/finance') || card.to === financeTo) return card;
|
||||
return { ...card, to: financeTo };
|
||||
});
|
||||
if (
|
||||
hub.key === 'customers' &&
|
||||
isMobileNav.value &&
|
||||
|
||||
Reference in New Issue
Block a user