All files / src/components/Messaging/SenderAction index.js

100% Statements 3/3
50% Branches 1/2
50% Functions 2/4
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38                              3x 3x                       3x                  
import Message from '../Message';
import { SENDER_ACTIONS } from '../constants';
 
/*
  Message state to display to the user:
 
  typing_on: display the typing bubble
  typing_off: remove the typing bubble
  mark_seen: display the confirmation icon
  Cannot be sent with message.Must be sent as a separate request.
 
  When using sender_action, recipient should be the only other property set in the request.
*/
class SenderAction extends Message {
  constructor(root, props) {
    super(root, props);
    this.action = props.action || SENDER_ACTIONS.TYPING_ON;
  }
 
  appendChild() {
    // noop
  }
 
  removeChild() {
    // noop
  }
 
  render() {
    return {
      messaging_type: this.type,
      recipient: this.recipient,
      sender_action: this.action
    };
  }
}
 
export default SenderAction;