Skip to content

Activity Status not being rendered when adding reactions as per sample #3473

@nathanlindorff

Description

@nathanlindorff

Adding reaction buttons as per https://github.com/microsoft/BotFramework-WebChat/tree/master/samples/05.custom-components/d.reaction-buttons/ results in the Activity Status (eg "5 minutes ago") not being rendered. Running the demo page associated with the sample shows the same issue (See screenshot)

I came across the issue while upgrading an older webchat from version 4.5 to 4.10. In the debugging I did for that the renderActivityStatus and renderAvatar functions are not being passed through as properties to the StackedLayout.

I realised after that that the sample had also changed, but the updated sample also displays the same issue.

Screenshots

From https://microsoft.github.io/BotFramework-WebChat/05.custom-components/d.reaction-buttons/

image

Debug screenshots from the bot i'm upgrading:

Props from StackedLayout bot message without reactions
image image

Props from StackedLayout bot message with reactions
image image

I haven't had a chance to update the code to match the updated reaction sample, but as stated the outcome (the missing status) is the same on the demo page.

class ThumbActivity extends React.Component<any> {
   public handleDownvoteButton = () => this.props.postActivity({ type: 'messageReaction', reactionsAdded: [{ activityID: this.props.activityID, helpful: -1 }] })
   public handleUpvoteButton = () => this.props.postActivity({ type: 'messageReaction', reactionsAdded: [{ activityID: this.props.activityID, helpful: 1 }] })

   public render() {
      const { props } = this

      return (
         <div style={thumbActivityStyle}>
            <div style={childActivityStyle}>{props.children}</div>
            <ul style={thumbsButtonBarStyle}>
               <li style={thumbsButtonListItemStyle}>
                  <button style={thumbButtonStyle} onClick={this.handleUpvoteButton}>👍</button>
               </li>
               <li style={thumbsButtonListItemStyle}>
                  <button style={thumbButtonStyle} onClick={this.handleDownvoteButton}>👎</button>
               </li>
            </ul>
         </div>
      )
   }
}

const ConnectedThumbActivity = (window as any).WebChat.connectToWebChat(
   ({ postActivity }) => ({ postActivity })
)(props => <ThumbActivity {...props} />)

export const thumbsMiddleware = () => next => card => {
   const allowReaction: boolean = card.activity.channelData && card.activity.channelData.allowReaction
   if (card.activity.from.role === 'bot' && allowReaction) {
      return children => (
         <ConnectedThumbActivity activityID={card.activity.id}>
            {next(card)(children)}
         </ConnectedThumbActivity>
      )
   } else {
      return next(card)
   }
}

I will update the code to use the new recommended syntax, but it appears based on the new sample that it will still be an issue.

Version

Version: 4.10 (Upgrading from 4.5)
Using NPM package
Embeded in iFrame

Describe the bug

When adding middleware to add reactions, the Activity Status and Avatar are not rendered.

Steps to reproduce

  1. See description and screenshots

Expected behavior

Expect message to render as per normal, with additional reaction elements.

[Bug]

Metadata

Metadata

Assignees

Labels

Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.bugIndicates an unexpected problem or an unintended behavior.customer-replied-toRequired for internal reporting. Do not delete.customer-reportedRequired for internal Azure reporting. Do not delete.p1Painful if we don't fix, won't block releasing

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions