Skip to content

Alkwa/dont render html messages#1149

Merged
alkwa-msft merged 8 commits intomainfrom
alkwa/dont-render-html-messages
Nov 24, 2021
Merged

Alkwa/dont render html messages#1149
alkwa-msft merged 8 commits intomainfrom
alkwa/dont-render-html-messages

Conversation

@alkwa-msft
Copy link
Copy Markdown
Contributor

What

We want to avoid rendering messages from Teams when a meeting is being recorded

Why

This content is not readable and creates a lot of noise in the chat thread. We will enable it again when we have a good way to display this information.

How Tested

Tested locally in storybook

Process & policy checklist

  • [ ✔] I have updated the project documentation to reflect my changes if necessary.
  • [ ✔] I have read the CONTRIBUTING documentation.

Is this a breaking change?
This is fixing a bug for now.

private onChatMessageReceived = (event: ChatMessageReceivedEvent): void => {
// Today we are avoiding how to render these messages. In the future we can
// remove this condition and handle this message appropriately.
if (event.type.startsWith('RichText/')) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any strong reason for avoiding these?
We can probably convert these to react components and render them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There could be any number of control messages. RichText/Media_CallRecording just happens to be one of them. It is better to filter on what we are expecting (Text or RichText/Html)

private onChatMessageReceived = (event: ChatMessageReceivedEvent): void => {
// Today we are avoiding how to render these messages. In the future we can
// remove this condition and handle this message appropriately.
if (event.type !== 'Text' && event.type !== 'RichText/Html') {
Copy link
Copy Markdown
Member

@JamesBurnside JamesBurnside Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not need a condition for 'html'? https://github.com/Azure/communication-ui-library/pull/946/files

Looking to avoid breaking: #824

Copy link
Copy Markdown
Member

@JamesBurnside JamesBurnside Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: convert the type we are checking to lowercase and use the enum ACSKnownMessageType we have for checking against

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, 'html' type is coming from teams sometimes - not sure if that is also the case for notifications

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huge inconsistence of type name/lower/upper cases from chatThreadClient.getMessages() and these notifications, which should be resolved by our chat sdk in their further release

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I am going to toLowerCase() and do checks against text richtext/html and html

all other messages are currently dropped.

private onChatMessageReceived = (event: ChatMessageReceivedEvent): void => {
// Today we are avoiding how to render these messages. In the future we can
// remove this condition and handle this message appropriately.
if (event.type !== 'Text' && event.type !== 'RichText/Html') {
Copy link
Copy Markdown
Contributor

@PorterNan PorterNan Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there concerns that we have to do it in stateful client? Since it is our component + selector's responsibility to render the message (and they don't support this type well), messages filter should be happening in messageThreadSelector.tsx - On the other hand, stateful client should always provide accurate data directly coming from js sdk (so developers can read messages and render them themselves even without our implementation)

We already have some filterings there in messageThreadSelector.tsx, I wonder why it is not working, I guess there could be some leakings for our conditions there

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sync with Alex offline, the big limitation for now is we froze api changes so we are not able to support more types in convertEventType() function above - for short term, this change makes a lot of change before we release the lock of api changes
In long term, we will need to open a bug and add new api changes and move this logic into selector after first GA release

@PorterNan
Copy link
Copy Markdown
Contributor

PorterNan commented Nov 24, 2021

According to my previous experience, 2 scenarioes might need to be tested for this PR around html type:

  1. Send a message using teams
  2. Send a message using chatThreadClient.sendMessage('Hello', {type: 'html'})

chatted with Ash and we can also potentially get html, so I am account for it as well.

@alkwa-msft alkwa-msft enabled auto-merge (squash) November 24, 2021 01:42
@alkwa-msft alkwa-msft merged commit 06c62ba into main Nov 24, 2021
@alkwa-msft alkwa-msft deleted the alkwa/dont-render-html-messages branch November 24, 2021 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Meeting Composite shows weird message when recording starts during Teams meeting

6 participants