-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added setting and method to control Livechat system messages vi…
…sibility (#31751)
- Loading branch information
1 parent
d742b25
commit 475c041
Showing
10 changed files
with
93 additions
and
8 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
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 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
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 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