Skip to content

Commit fbf6c08

Browse files
fix: add missing Security Logs menu item to navbar V2 (RocketChat#36080)
1 parent 2f162a0 commit fbf6c08

3 files changed

Lines changed: 43 additions & 1 deletion

File tree

.changeset/popular-bugs-hide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rocket.chat/meteor": patch
3+
---
4+
5+
Fixes issue preventing the Security Logs from being accessed using the Enhanced Navbar in feature preview

apps/meteor/client/NavBarV2/NavBarSettingsToolbar/hooks/useAuditMenu.spec.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,30 @@ it('should return audiLogs item if have license and can-audit-log permission', a
129129
),
130130
);
131131
});
132+
133+
it('should return auditSecurityLog item if have license and can-audit-log permission', async () => {
134+
const { result } = renderHook(() => useAuditMenu(), {
135+
wrapper: mockAppRoot()
136+
.withEndpoint('GET', '/v1/licenses.info', () => ({
137+
license: {
138+
license: {
139+
// @ts-expect-error: just for testing
140+
grantedModules: [{ module: 'auditing' }],
141+
},
142+
// @ts-expect-error: just for testing
143+
activeModules: ['auditing'],
144+
},
145+
}))
146+
.withJohnDoe()
147+
.withPermission('can-audit')
148+
.build(),
149+
});
150+
151+
await waitFor(() =>
152+
expect(result.current.items[1]).toEqual(
153+
expect.objectContaining({
154+
id: 'auditSecurityLog',
155+
}),
156+
),
157+
);
158+
});

apps/meteor/client/NavBarV2/NavBarSettingsToolbar/hooks/useAuditMenu.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,18 @@ export const useAuditMenu = () => {
2525
onClick: () => router.navigate('/audit-log'),
2626
};
2727

28+
const auditSecurityLogsItem: GenericMenuItemProps = {
29+
id: 'auditSecurityLog',
30+
content: t('Security_logs'),
31+
onClick: () => router.navigate('/security-logs'),
32+
};
33+
2834
return {
2935
title: t('Audit'),
30-
items: [hasAuditPermission && auditMessageItem, hasAuditLogPermission && auditLogItem].filter(Boolean) as GenericMenuItemProps[],
36+
items: [
37+
hasAuditPermission && auditMessageItem,
38+
hasAuditLogPermission && auditLogItem,
39+
hasAuditPermission && auditSecurityLogsItem,
40+
].filter(Boolean) as GenericMenuItemProps[],
3141
};
3242
};

0 commit comments

Comments
 (0)