Skip to content

Commit

Permalink
Modify the handleSend to use the operators from ModeSelectors
Browse files Browse the repository at this point in the history
  • Loading branch information
kunall17 committed May 22, 2017
1 parent ded3b92 commit 43c0552
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/compose/ComposeText.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,15 @@ export default class ComposeText extends React.Component {
}

handleSend = () => {
const { auth, narrow } = this.props;
const { auth, operator, operand } = this.props;
const { text } = this.state;

if (isPrivateOrGroupNarrow(narrow)) {
sendMessage(auth, 'private', narrow[0].operand, '', text);
} else if (isStreamNarrow(narrow)) {
sendMessage(auth, 'stream', narrow[0].operand, '(no topic)', text);
} else if (isTopicNarrow(narrow)) {
sendMessage(auth, 'stream', narrow[0].operand, narrow[1].operand, text);
if (operator === 'pm-with') {
sendMessage(auth, 'private', operand, '', text);
} else if (operand === '') {
sendMessage(auth, 'stream', operator, '(no topic)', text);
} else {
sendMessage(auth, 'stream', operator, operand, text);
}

this.clearInput();
}

Expand Down

0 comments on commit 43c0552

Please sign in to comment.