Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/popular-bugs-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes issue preventing the Security Logs from being accessed using the Enhanced Navbar in feature preview
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,30 @@ it('should return audiLogs item if have license and can-audit-log permission', a
),
);
});

it('should return auditSecurityLog item if have license and can-audit-log permission', async () => {
const { result } = renderHook(() => useAuditMenu(), {
wrapper: mockAppRoot()
.withEndpoint('GET', '/v1/licenses.info', () => ({
license: {
license: {
// @ts-expect-error: just for testing
grantedModules: [{ module: 'auditing' }],
},
// @ts-expect-error: just for testing
activeModules: ['auditing'],
},
}))
.withJohnDoe()
.withPermission('can-audit')
.build(),
});

await waitFor(() =>
expect(result.current.items[1]).toEqual(
expect.objectContaining({
id: 'auditSecurityLog',
}),
),
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,18 @@ export const useAuditMenu = () => {
onClick: () => router.navigate('/audit-log'),
};

const auditSecurityLogsItem: GenericMenuItemProps = {
id: 'auditSecurityLog',
content: t('Security_logs'),
onClick: () => router.navigate('/security-logs'),
};

return {
title: t('Audit'),
items: [hasAuditPermission && auditMessageItem, hasAuditLogPermission && auditLogItem].filter(Boolean) as GenericMenuItemProps[],
items: [
hasAuditPermission && auditMessageItem,
hasAuditLogPermission && auditLogItem,
hasAuditPermission && auditSecurityLogsItem,
].filter(Boolean) as GenericMenuItemProps[],
};
};
Loading