Skip to content

Commit

Permalink
Add blocked message types for DLP violated messages
Browse files Browse the repository at this point in the history
Signed-off-by: Musale Martin <[email protected]>
  • Loading branch information
musale committed Aug 15, 2023
1 parent 46b0d0f commit 69ba3a7
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 337 deletions.
9 changes: 5 additions & 4 deletions packages/mgt-chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@
"typescript": "^4.9.5"
},
"dependencies": {
"@azure/communication-calling": "1.10.1",
"@azure/communication-chat": "1.3.0",
"@azure/communication-common": "2.2.0",
"@azure/communication-calling": "1.15.2",
"@azure/communication-chat": "1.3.1",
"@azure/communication-common": "2.2.1",
"@azure/communication-identity": "1.2.0",
"@azure/communication-react": "1.5.0",
"@azure/communication-react": "1.7.0-beta.2",
"@azure/communication-calling-effects": "1.0.1",
"@azure/msal-browser": "2.33.0",
"@fluentui/react": "~8.106.1",
"@fluentui/react-northstar": "^0.66.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,8 @@ detail: ${JSON.stringify(eventDetail)}`);
// trying to filter out messages on the graph request causes a 400
// deleted messages are returned as messages with no content, which we can't filter on the graph request
// so we filter them out here
.filter(m => m.body?.content)
// Violating DLP returns content as empty BUT with policyViolation set
.filter(m => m.body?.content || (!m.body?.content && m?.policyViolation))
// This gives us both current and eventual values for each message
.map(m => this.convertChatMessage(m));

Expand Down Expand Up @@ -873,10 +874,14 @@ detail: ${JSON.stringify(eventDetail)}`);
content: string
): AcsChatMessage {
const senderId = graphMessage.from?.user?.id || undefined;
let messageType = 'chat';
if (graphMessage?.policyViolation) {
messageType = 'blocked';
}
return {
messageId,
contentType: graphMessage.body?.contentType ?? 'text',
messageType: 'chat',
messageType,
content,
senderDisplayName: graphMessage.from?.user?.displayName ?? undefined,
createdOn: new Date(graphMessage.createdDateTime ?? Date.now()),
Expand Down
Loading

0 comments on commit 69ba3a7

Please sign in to comment.