-
Notifications
You must be signed in to change notification settings - Fork 13.9k
feat: Added setting and method to control Livechat system messages visibility #31751
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
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f0fd186
feat: added method setHiddenSystemMessages to the api
7741095
feat: added new config to allow hiding livechat system messages
f20cb88
chore: moved setting to the correct section
c252ee8
fix: merging configs instead of choosing one or the other
50a73a4
chore: removed empty space
2aa07c4
fix: removed message types not relevant to Livechat
d4c54b5
chore: added pt-BR translations keys
8672ee9
chore: improved EN translation keys
aff886c
chore: changeset
ba2d5e2
chore: changeset
6152f56
refactor: replaced console.error with throw Error
cdadc01
feat: added hideSystemMessages to initialize method
7b78e2a
fix: small adjustment
06c2cd6
fix: filter out invalid system message types
83dd561
chore: added warning for invalid system messages
280332d
chore: removed "video call" message type as an option to hide
fef35b0
refactor: moved setting to ee
00997b0
fix: added missing invalidValue
a222f18
Merge branch 'develop' into feat/livechat-hide-system-messages
kodiakhq[bot] 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@rocket.chat/meteor": minor | ||
| "@rocket.chat/livechat": minor | ||
| --- | ||
|
|
||
| Added Livechat setting `Hide system messages` & API method `setHiddenSystemMessages`, to customize system message visibility within the widget. |
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
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,27 +1,40 @@ | ||
| import { | ||
| MESSAGE_TYPE_COMMAND, | ||
| MESSAGE_TYPE_LIVECHAT_CLOSED, | ||
| MESSAGE_TYPE_LIVECHAT_NAVIGATION_HISTORY, | ||
| MESSAGE_TYPE_PRIORITY_CHANGE, | ||
| MESSAGE_TYPE_ROOM_NAME_CHANGED, | ||
| MESSAGE_TYPE_SLA_CHANGE, | ||
| MESSAGE_TYPE_USER_ADDED, | ||
| MESSAGE_TYPE_USER_JOINED, | ||
| MESSAGE_TYPE_USER_LEFT, | ||
| MESSAGE_TYPE_USER_REMOVED, | ||
| MESSAGE_TYPE_WELCOME, | ||
| MESSAGE_VIDEO_CALL, | ||
| MESSAGE_WEBRTC_CALL, | ||
| } from '../components/Messages/constants'; | ||
| import store from '../store'; | ||
|
|
||
| const msgTypesNotRendered = [ | ||
| MESSAGE_TYPE_WELCOME, | ||
| MESSAGE_TYPE_ROOM_NAME_CHANGED, | ||
| MESSAGE_TYPE_USER_ADDED, | ||
| MESSAGE_TYPE_USER_REMOVED, | ||
| MESSAGE_VIDEO_CALL, | ||
| MESSAGE_WEBRTC_CALL, | ||
| MESSAGE_TYPE_LIVECHAT_NAVIGATION_HISTORY, | ||
| MESSAGE_TYPE_USER_ADDED, | ||
| MESSAGE_TYPE_COMMAND, | ||
| MESSAGE_TYPE_USER_JOINED, | ||
| MESSAGE_TYPE_USER_LEFT, | ||
| MESSAGE_TYPE_LIVECHAT_CLOSED, | ||
| MESSAGE_TYPE_PRIORITY_CHANGE, | ||
| MESSAGE_TYPE_SLA_CHANGE, | ||
| ]; | ||
|
|
||
| export const canRenderMessage = ({ t }: { t: string }) => !msgTypesNotRendered.includes(t); | ||
| export const getHiddenSystemMessages = () => { | ||
| const { config, iframe } = store.state; | ||
| const configHiddenSystemMessages = config.settings.hiddenSystemMessages || []; | ||
| const localHiddenSystemMessages = iframe.hiddenSystemMessages || []; | ||
|
|
||
| return [...configHiddenSystemMessages, ...localHiddenSystemMessages] as string[]; | ||
| }; | ||
|
|
||
| export const canRenderMessage = ({ t }: { t: string }) => { | ||
| const hiddenSystemMessages = getHiddenSystemMessages(); | ||
|
|
||
| return !msgTypesNotRendered.includes(t) && !hiddenSystemMessages.includes(t); | ||
| }; | ||
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
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.