diff --git a/CHANGELOG.md b/CHANGELOG.md index a36d5456d..8c664fc6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [client] Modified 'Open Bot' dialog text in PR [#1330](https://github.com/Microsoft/BotFramework-Emulator/pull/1330) - [client] Allow text to be selected in webchat in PR [#1351](https://github.com/Microsoft/BotFramework-Emulator/pull/1351) - [client] Pass along user name to webchat in PR [#1353](https://github.com/Microsoft/BotFramework-Emulator/pull/1353) +- [client] Do not render certain activities in webchat in PR [#1363](https://github.com/Microsoft/BotFramework-Emulator/pull/1363) ## v4.3.0 - 2019 - 03 - 04 ### Added diff --git a/packages/app/client/src/ui/editor/emulator/parts/chat/chat.spec.tsx b/packages/app/client/src/ui/editor/emulator/parts/chat/chat.spec.tsx index 599009731..5da07e9d6 100644 --- a/packages/app/client/src/ui/editor/emulator/parts/chat/chat.spec.tsx +++ b/packages/app/client/src/ui/editor/emulator/parts/chat/chat.spec.tsx @@ -117,6 +117,20 @@ describe('', () => { }); expect(activityWrapper.text()).toEqual('a child node'); }); + + ['trace', 'endOfConversation'].forEach((type: string) => { + it(`does not render ${type} activities`, () => { + const next = (contents: any) => (kids: any) => kids; + const card = { activity: { id: 'activity-id', type } }; + const children = 'a child node'; + const webChat = render().find(ReactWebChat); + + const middleware = webChat.prop('activityMiddleware') as any; + const activityWrapper = middleware()(next)(card)(children); + + expect(activityWrapper).toBeNull(); + }); + }); }); describe('speech services', () => { diff --git a/packages/app/client/src/ui/editor/emulator/parts/chat/chat.tsx b/packages/app/client/src/ui/editor/emulator/parts/chat/chat.tsx index 7426da842..7c9662b63 100644 --- a/packages/app/client/src/ui/editor/emulator/parts/chat/chat.tsx +++ b/packages/app/client/src/ui/editor/emulator/parts/chat/chat.tsx @@ -146,13 +146,19 @@ export class Chat extends Component { return
Not Connected
; } - private createActivityMiddleware = () => next => card => children => ( - - {next(card)(children)} - - ); + private createActivityMiddleware = () => next => card => children => { + if (/(trace|endOfConversation)/.test(card.activity.type)) { + return null; + } + + return ( + + {next(card)(children)} + + ); + }; }