Fix broken "Delivery History" link on OSS/Community editions

This commit is contained in:
Maurus Decimus
2026-05-01 09:03:02 +02:00
parent ba6b4472d2
commit dee0f7fbe3
2 changed files with 30 additions and 9 deletions
+9
View File
@@ -2,6 +2,15 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
## [1.0.3] - 2026-05-XX
### Added
### Changed
### Fixed
- Broken "Delivery History" link on OSS/Community editions.
## [1.0.2] - 2026-04-30 ## [1.0.2] - 2026-04-30
### Added ### Added
+21 -9
View File
@@ -17,6 +17,7 @@ import {
ArrowUpDown, ArrowUpDown,
Filter, Filter,
Loader2, Loader2,
Lock,
Search, Search,
RotateCcw, RotateCcw,
} from 'lucide-react'; } from 'lucide-react';
@@ -46,6 +47,7 @@ import {
} from '@/components/ui/alert-dialog'; } from '@/components/ui/alert-dialog';
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@/components/ui/collapsible'; import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@/components/ui/collapsible';
import { ObjectPicker } from '@/components/common/ObjectPicker'; import { ObjectPicker } from '@/components/common/ObjectPicker';
import { EnterpriseUpsell } from '@/components/common/EnterpriseUpsell';
import { toast } from '@/hooks/use-toast'; import { toast } from '@/hooks/use-toast';
import { friendlySetError } from '@/lib/jmapErrors'; import { friendlySetError } from '@/lib/jmapErrors';
import { coerceLabel } from '@/lib/objectOptions'; import { coerceLabel } from '@/lib/objectOptions';
@@ -319,6 +321,8 @@ export function DynamicList({ viewName }: DynamicListProps) {
const schema = useSchemaStore((s) => s.schema); const schema = useSchemaStore((s) => s.schema);
const viewToSection = useSchemaStore((s) => s.viewToSection); const viewToSection = useSchemaStore((s) => s.viewToSection);
const hasObjectPermission = useAccountStore((s) => s.hasObjectPermission); const hasObjectPermission = useAccountStore((s) => s.hasObjectPermission);
const edition = useAccountStore((s) => s.edition);
const [upsellOpen, setUpsellOpen] = useState(false);
const resolved = useMemo(() => { const resolved = useMemo(() => {
if (!schema) return null; if (!schema) return null;
@@ -1020,17 +1024,20 @@ export function DynamicList({ viewName }: DynamicListProps) {
function renderItemActions(item: Record<string, unknown>): React.ReactNode { function renderItemActions(item: Record<string, unknown>): React.ReactNode {
if (!hasItemActions || !list.itemActions) return null; if (!hasItemActions || !list.itemActions) return null;
const filteredActions = list.itemActions.filter((action) => { const filteredActions = list.itemActions.flatMap((action): { action: ItemAction; locked: boolean }[] => {
if (action.type === 'separator') return true; if (action.type === 'separator') return [{ action, locked: false }];
if (action.type === 'delete') return canDelete; if (action.type === 'delete') return canDelete ? [{ action, locked: false }] : [];
if (action.type === 'setProperty') return canUpdate; if (action.type === 'setProperty') return canUpdate ? [{ action, locked: false }] : [];
if (action.type === 'view' || action.type === 'query') { if (action.type === 'view' || action.type === 'query') {
const targetObj = resolveObject(schema!, action.objectName); const targetObj = resolveObject(schema!, action.objectName);
if (targetObj && !hasObjectPermission(targetObj.permissionPrefix, 'Get')) { if (!targetObj) return [];
return false; if (targetObj.enterprise) {
if (edition === 'oss') return [];
if (edition === 'community') return [{ action, locked: true }];
} }
if (!hasObjectPermission(targetObj.permissionPrefix, 'Get')) return [];
} }
return true; return [{ action, locked: false }];
}); });
if (filteredActions.length === 0) return null; if (filteredActions.length === 0) return null;
@@ -1043,7 +1050,7 @@ export function DynamicList({ viewName }: DynamicListProps) {
</Button> </Button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end"> <DropdownMenuContent align="end">
{filteredActions.map((action, idx) => { {filteredActions.map(({ action, locked }, idx) => {
if (action.type === 'separator') { if (action.type === 'separator') {
return <DropdownMenuSeparator key={`sep-${idx}`} />; return <DropdownMenuSeparator key={`sep-${idx}`} />;
} }
@@ -1057,7 +1064,9 @@ export function DynamicList({ viewName }: DynamicListProps) {
className={isDestructive ? 'text-destructive' : undefined} className={isDestructive ? 'text-destructive' : undefined}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
if (needsConfirmation) { if (locked) {
setUpsellOpen(true);
} else if (needsConfirmation) {
setConfirmAction({ setConfirmAction({
label: action.label, label: action.label,
onConfirm: () => executeItemAction(action, item), onConfirm: () => executeItemAction(action, item),
@@ -1068,6 +1077,7 @@ export function DynamicList({ viewName }: DynamicListProps) {
}} }}
> >
{action.label} {action.label}
{locked && <Lock className="ml-auto h-3 w-3 text-muted-foreground" />}
</DropdownMenuItem> </DropdownMenuItem>
); );
})} })}
@@ -1352,6 +1362,8 @@ export function DynamicList({ viewName }: DynamicListProps) {
</AlertDialogFooter> </AlertDialogFooter>
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>
<EnterpriseUpsell open={upsellOpen} onClose={() => setUpsellOpen(false)} />
</div> </div>
); );
} }