Skip to content
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

do not render certain activity types in webchat #1363

Merged
merged 2 commits into from
Mar 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,20 @@ describe('<Chat />', () => {
});
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', () => {
Expand Down
24 changes: 15 additions & 9 deletions packages/app/client/src/ui/editor/emulator/parts/chat/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,19 @@ export class Chat extends Component<ChatProps, ChatState> {
return <div className={styles.disconnected}>Not Connected</div>;
}

private createActivityMiddleware = () => next => card => children => (
<ActivityWrapper
activity={card.activity}
onClick={this.props.updateSelectedActivity}
isSelected={isCardSelected(this.props.selectedActivity, card.activity)}
>
{next(card)(children)}
</ActivityWrapper>
);
private createActivityMiddleware = () => next => card => children => {
if (/(trace|endOfConversation)/.test(card.activity.type)) {
return null;
}

return (
<ActivityWrapper
activity={card.activity}
onClick={this.props.updateSelectedActivity}
isSelected={isCardSelected(this.props.selectedActivity, card.activity)}
>
{next(card)(children)}
</ActivityWrapper>
);
};
}