Skip to content

Commit

Permalink
Merge branch 'master' into toanzian/#1362-contenturl
Browse files Browse the repository at this point in the history
  • Loading branch information
a-b-r-o-w-n committed Mar 11, 2019
2 parents 9ec1e01 + 7c49920 commit 0ec9970
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
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)
- [core] Fixed issue with contentUrl for attachments in PR [#1364](https://github.com/Microsoft/BotFramework-Emulator/pull/1364)

## v4.3.0 - 2019 - 03 - 04
Expand Down
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
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>
);
};
}

0 comments on commit 0ec9970

Please sign in to comment.