-
Notifications
You must be signed in to change notification settings - Fork 13.1k
regression: Outbound message permissions not available in Community Edition #37107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tassoevan
merged 4 commits into
release-7.11.0
from
regression/outbound-comms-permissions
Oct 2, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
apps/meteor/client/components/Omnichannel/OutboundMessage/hooks/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './useOutboundMessageAccess'; |
82 changes: 82 additions & 0 deletions
82
...teor/client/components/Omnichannel/OutboundMessage/hooks/useOutboundMessageAccess.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import { usePermission } from '@rocket.chat/ui-contexts'; | ||
| import { renderHook } from '@testing-library/react'; | ||
|
|
||
| import { useOutboundMessageAccess } from './useOutboundMessageAccess'; | ||
| import { useOmnichannelEnabled } from '../../../../hooks/omnichannel/useOmnichannelEnabled'; | ||
| import { useHasLicenseModule } from '../../../../hooks/useHasLicenseModule'; | ||
|
|
||
| jest.mock('@rocket.chat/ui-contexts', () => ({ | ||
| usePermission: jest.fn(), | ||
| })); | ||
|
|
||
| jest.mock('../../../../hooks/omnichannel/useOmnichannelEnabled', () => ({ | ||
| useOmnichannelEnabled: jest.fn(), | ||
| })); | ||
|
|
||
| jest.mock('../../../../hooks/useHasLicenseModule', () => ({ | ||
| useHasLicenseModule: jest.fn(), | ||
| })); | ||
|
|
||
| const usePermissionMock = jest.mocked(usePermission); | ||
| const useOmnichannelEnabledMock = jest.mocked(useOmnichannelEnabled); | ||
| const useHasLicenseModuleMock = jest.mocked(useHasLicenseModule); | ||
|
|
||
| describe('useOutboundMessageAccess', () => { | ||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| it('should return false if omnichannel is not enabled', () => { | ||
| useOmnichannelEnabledMock.mockReturnValue(false); | ||
| useHasLicenseModuleMock.mockReturnValue(true); | ||
| usePermissionMock.mockReturnValue(true); | ||
|
|
||
| const { result } = renderHook(() => useOutboundMessageAccess()); | ||
| expect(result.current).toBe(false); | ||
| }); | ||
|
|
||
| it('should return true if omnichannel module is missing (upsell)', () => { | ||
| useOmnichannelEnabledMock.mockReturnValue(true); | ||
| useHasLicenseModuleMock.mockImplementation((module) => module !== 'livechat-enterprise'); | ||
| usePermissionMock.mockReturnValue(true); | ||
|
|
||
| const { result } = renderHook(() => useOutboundMessageAccess()); | ||
| expect(result.current).toBe(true); | ||
| }); | ||
|
|
||
| it('should return true if outbound module is missing (upsell)', () => { | ||
| useOmnichannelEnabledMock.mockReturnValue(true); | ||
| useHasLicenseModuleMock.mockImplementation((module) => module !== 'outbound-messaging'); | ||
| usePermissionMock.mockReturnValue(true); | ||
|
|
||
| const { result } = renderHook(() => useOutboundMessageAccess()); | ||
| expect(result.current).toBe(true); | ||
| }); | ||
|
|
||
| it('should return true if both modules are missing (upsell)', () => { | ||
| useOmnichannelEnabledMock.mockReturnValue(true); | ||
| useHasLicenseModuleMock.mockReturnValue(false); | ||
| usePermissionMock.mockReturnValue(true); | ||
|
|
||
| const { result } = renderHook(() => useOutboundMessageAccess()); | ||
| expect(result.current).toBe(true); | ||
| }); | ||
|
|
||
| it('should return true if all conditions are met and user has permission', () => { | ||
| useOmnichannelEnabledMock.mockReturnValue(true); | ||
| useHasLicenseModuleMock.mockReturnValue(true); | ||
| usePermissionMock.mockReturnValue(true); | ||
|
|
||
| const { result } = renderHook(() => useOutboundMessageAccess()); | ||
| expect(result.current).toBe(true); | ||
| }); | ||
|
|
||
| it('should return false if all conditions are met but user does not have permission', () => { | ||
| useOmnichannelEnabledMock.mockReturnValue(true); | ||
| useHasLicenseModuleMock.mockReturnValue(true); | ||
| usePermissionMock.mockReturnValue(false); | ||
|
|
||
| const { result } = renderHook(() => useOutboundMessageAccess()); | ||
| expect(result.current).toBe(false); | ||
| }); | ||
| }); |
21 changes: 21 additions & 0 deletions
21
apps/meteor/client/components/Omnichannel/OutboundMessage/hooks/useOutboundMessageAccess.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { usePermission } from '@rocket.chat/ui-contexts'; | ||
|
|
||
| import { useOmnichannelEnabled } from '../../../../hooks/omnichannel/useOmnichannelEnabled'; | ||
| import { useHasLicenseModule } from '../../../../hooks/useHasLicenseModule'; | ||
|
|
||
| export const useOutboundMessageAccess = (): boolean => { | ||
| const isOmnichannelEnabled = useOmnichannelEnabled(); | ||
| const hasOmnichannelModule = useHasLicenseModule('livechat-enterprise') === true; | ||
| const hasOutboundModule = useHasLicenseModule('outbound-messaging') === true; | ||
| const hasPermission = usePermission('outbound.send-messages'); | ||
|
|
||
| if (!isOmnichannelEnabled) { | ||
| return false; | ||
| } | ||
|
|
||
| if (!hasOmnichannelModule || !hasOutboundModule) { | ||
| return true; | ||
| } | ||
|
|
||
| return hasPermission; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
apps/meteor/client/components/Omnichannel/OutboundMessage/modals/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| export * from './OutboundMessageUpsellModal'; | ||
| export * from './OutboundMessageModal'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.