-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regression: Show messages instead of the composer when there is no ac…
…tion available on federated rooms (#28093) Co-authored-by: Guilherme Gazzo <5263975+ggazzo@users.noreply.github.com> Co-authored-by: Douglas Fabris <27704687+dougfabris@users.noreply.github.com>
- Loading branch information
1 parent
b032dd6
commit b3e656a
Showing
15 changed files
with
122 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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 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 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
40 changes: 40 additions & 0 deletions
40
...teor/client/views/room/components/body/composer/ComposerFederation/ComposerFederation.tsx
This file contains 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,40 @@ | ||
import type { IRoom } from '@rocket.chat/core-typings'; | ||
import { useSetting } from '@rocket.chat/ui-contexts'; | ||
import React from 'react'; | ||
import type { ReactElement } from 'react'; | ||
|
||
import { useHasLicenseModule } from '../../../../../../../ee/client/hooks/useHasLicenseModule'; | ||
import type { ComposerMessageProps } from '../ComposerMessage'; | ||
import ComposerMessage from '../ComposerMessage'; | ||
import ComposerFederationDisabled from './ComposerFederationDisabled'; | ||
import ComposerFederationJoinRoomDisabled from './ComposerFederationJoinRoomDisabled'; | ||
|
||
const ComposerFederation = ({ room, subscription, children, ...props }: ComposerMessageProps & { room: IRoom }): ReactElement => { | ||
const federationEnabled = useSetting('Federation_Matrix_enabled') === true; | ||
const federationModuleEnabled = useHasLicenseModule('federation') === true; | ||
|
||
if (!federationEnabled) { | ||
return ( | ||
<footer className='rc-message-box footer'> | ||
<ComposerFederationDisabled /> | ||
</footer> | ||
); | ||
} | ||
|
||
if (!subscription && !federationModuleEnabled) { | ||
return ( | ||
<footer className='rc-message-box footer'> | ||
<ComposerFederationJoinRoomDisabled /> | ||
</footer> | ||
); | ||
} | ||
|
||
return ( | ||
<footer className='rc-message-box footer'> | ||
{children} | ||
<ComposerMessage readOnly={room.ro} {...props} /> | ||
</footer> | ||
); | ||
}; | ||
|
||
export default ComposerFederation; |
12 changes: 12 additions & 0 deletions
12
...ent/views/room/components/body/composer/ComposerFederation/ComposerFederationDisabled.tsx
This file contains 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,12 @@ | ||
import { MessageFooterCallout } from '@rocket.chat/ui-composer'; | ||
import { useTranslation } from '@rocket.chat/ui-contexts'; | ||
import type { ReactElement } from 'react'; | ||
import React from 'react'; | ||
|
||
const ComposerFederationDisabled = (): ReactElement => { | ||
const t = useTranslation(); | ||
|
||
return <MessageFooterCallout>{t('Federation_Matrix_Federated_Description_disabled')}</MessageFooterCallout>; | ||
}; | ||
|
||
export default ComposerFederationDisabled; |
12 changes: 12 additions & 0 deletions
12
...s/room/components/body/composer/ComposerFederation/ComposerFederationJoinRoomDisabled.tsx
This file contains 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,12 @@ | ||
import { MessageFooterCallout } from '@rocket.chat/ui-composer'; | ||
import { useTranslation } from '@rocket.chat/ui-contexts'; | ||
import type { ReactElement } from 'react'; | ||
import React from 'react'; | ||
|
||
const ComposerFederationJoinRoomDisabled = (): ReactElement => { | ||
const t = useTranslation(); | ||
|
||
return <MessageFooterCallout>{t('Federation_Matrix_join_public_rooms_is_enterprise')}</MessageFooterCallout>; | ||
}; | ||
|
||
export default ComposerFederationJoinRoomDisabled; |
1 change: 1 addition & 0 deletions
1
apps/meteor/client/views/room/components/body/composer/ComposerFederation/index.ts
This file contains 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 { default } from './ComposerFederation'; |
This file contains 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 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 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 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 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 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 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 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