Skip to content

Commit 607ba96

Browse files
tdurnfordcorinagum
authored andcommitted
Updated Customize Web Chat with Reaction Buttons Sample (#2239)
* Updated button handles to send messageReaction activities * Updated CHANGLELOG.md * Updated sample readme * Updated sample readme
1 parent f5b8db5 commit 607ba96

3 files changed

Lines changed: 10 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6666

6767
### Samples
6868

69-
- `*`: [Single sign-on for Microsoft Teams apps](https://microsoft.github.io/BotFramework-WebChat/19.c.single-sign-on-for-teams-apps/), by [@compulim](https://github.com/compulim) in [#2196](https://github.com/microsoft/BotFramework-WebChat/pull/2196)
69+
- [Single sign-on for Microsoft Teams apps](https://microsoft.github.io/BotFramework-WebChat/19.c.single-sign-on-for-teams-apps/), by [@compulim](https://github.com/compulim) in [#2196](https://github.com/microsoft/BotFramework-WebChat/pull/2196)
70+
- [Customize Web Chat with Reaction Buttons](https://microsoft.github.io/BotFramework-WebChat/09.customization-reaction-buttons/). Updated reaction handlers to send `messageReaction` activities, by [@tdurnford](https://github.com/tdurnford) in [#2239](https://github.com/microsoft/BotFramework-WebChat/pull/2239)
7071

7172
## [4.5.0] - 2019-07-10
7273

samples/09.customization-reaction-buttons/README.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,8 @@ Let's start building the React Component. It will have two methods, `handleDownv
3131

3232
```jsx
3333
class ActivityWithFeedback extends React.Component {
34-
handleDownvoteButton = () =>
35-
this.props.postActivity({
36-
type: 'message',
37-
name: 'evaluate-activity',
38-
value: { activityID: this.props.activityID, helpful: -1 }
39-
});
40-
handleUpvoteButton = () =>
41-
this.props.postActivity({
42-
type: 'message',
43-
name: 'evaluate-activity',
44-
value: { activityID: this.props.activityID, helpful: 1 }
45-
});
34+
handleDownvoteButton = () => this.props.postActivity({ type: 'messageReaction', reactionsAdded: [{ activityID: this.props.activityID, helpful: -1 }] })
35+
handleUpvoteButton = () => this.props.postActivity({ type: 'messageReaction', reactionsAdded: [{ activityID: this.props.activityID, helpful: 1 }] })
4636

4737
render() {
4838
const { props } = this;
@@ -93,8 +83,8 @@ Next, add styling via glamor and the classes that will be applied in this compon
9383
+ });
9484

9585
class ActivityWithFeedback extends React.Component {
96-
handleDownvoteButton = () => this.props.postActivity({ type: 'message', name: 'evaluate-activity', value: { activityID: this.props.activityID, helpful: -1 } })
97-
handleUpvoteButton = () => this.props.postActivity({ type: 'message', name: 'evaluate-activity', value: { activityID: this.props.activityID, helpful: 1 } })
86+
handleDownvoteButton = () => this.props.postActivity({ type: 'messageReaction', reactionsAdded: [{ activityID: this.props.activityID, helpful: -1 }] })
87+
handleUpvoteButton = () => this.props.postActivity({ type: 'messageReaction', reactionsAdded: [{ activityID: this.props.activityID, helpful: 1 }] })
9888

9989
render() {
10090
const { props } = this;
@@ -198,8 +188,8 @@ Make sure `activityMiddleware` is passed into the the Web Chat component, and th
198188
+ });
199189

200190
+ class ActivityWithFeedback extends React.Component {
201-
+ handleDownvoteButton = () => this.props.postActivity({ type: 'message', name: 'evaluate-activity', value: { activityID: this.props.activityID, helpful: -1 } })
202-
+ handleUpvoteButton = () => this.props.postActivity({ type: 'message', name: 'evaluate-activity', value: { activityID: this.props.activityID, helpful: 1 } })
191+
+ handleDownvoteButton = () => this.props.postActivity({ type: 'messageReaction', reactionsAdded: [{ activityID: this.props.activityID, helpful: -1 }] })
192+
+ handleUpvoteButton = () => this.props.postActivity({ type: 'messageReaction', reactionsAdded: [{ activityID: this.props.activityID, helpful: 1 }] })
203193

204194
+ render() {
205195
+ const { props } = this;

samples/09.customization-reaction-buttons/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
});
6565

6666
class ActivityWithFeedback extends React.Component {
67-
handleDownvoteButton = () => this.props.postActivity({ type: 'message', name: 'evaluate-activity', value: { activityID: this.props.activityID, helpful: -1 } })
68-
handleUpvoteButton = () => this.props.postActivity({ type: 'message', name: 'evaluate-activity', value: { activityID: this.props.activityID, helpful: 1 } })
67+
handleDownvoteButton = () => this.props.postActivity({ type: 'messageReaction', reactionsAdded: [{ activityID: this.props.activityID, helpful: -1 }] })
68+
handleUpvoteButton = () => this.props.postActivity({ type: 'messageReaction', reactionsAdded: [{ activityID: this.props.activityID, helpful: 1 }] })
6969

7070
render() {
7171
const { props } = this;

0 commit comments

Comments
 (0)