Skip to content

Commit

Permalink
Draft channel indicator to ignore message with whitespaces only (matt…
Browse files Browse the repository at this point in the history
…ermost#1819)

* Draft channel indicator to ignore message with whitespaces only

* feedback review
  • Loading branch information
enahum committed Oct 3, 2018
1 parent 57e963c commit 397d4db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/sidebar/sidebar_channel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function makeMapStateToProps() {
channelTeammateId,
channelTeammateUsername,
channelTeammateDeletedAt,
hasDraft: Boolean(draft.message || draft.fileInfos.length || draft.uploadsInProgress.length) && currentChannelId !== channel.id,
hasDraft: draft && Boolean(draft.message.trim() || draft.fileInfos.length || draft.uploadsInProgress.length) && currentChannelId !== channel.id,
showTutorialTip: enableTutorial && tutorialStep === Constants.TutorialSteps.CHANNEL_POPOVER,
townSquareDisplayName: channelsByName[Constants.DEFAULT_CHANNEL] && channelsByName[Constants.DEFAULT_CHANNEL].display_name,
offTopicDisplayName: channelsByName[Constants.OFFTOPIC_CHANNEL] && channelsByName[Constants.OFFTOPIC_CHANNEL].display_name,
Expand Down
4 changes: 2 additions & 2 deletions components/suggestion/switch_channel_provider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ class SwitchChannelSuggestion extends Suggestion {

function mapStateToPropsForSwitchChannelSuggestion(state, ownProps) {
const channelId = ownProps.item && ownProps.item.channel ? ownProps.item.channel.id : '';
const draft = getPostDraft(state, StoragePrefixes.DRAFT, channelId);
const draft = channelId ? getPostDraft(state, StoragePrefixes.DRAFT, channelId) : false;

return {
channelMember: getMyChannelMemberships(state)[channelId],
hasDraft: Boolean(draft.message || draft.fileInfos.length || draft.uploadsInProgress.length),
hasDraft: draft && Boolean(draft.message.trim() || draft.fileInfos.length || draft.uploadsInProgress.length),
};
}

Expand Down

0 comments on commit 397d4db

Please sign in to comment.