diff --git a/src/views/messages/container.jsx b/src/views/messages/container.jsx index 0fd9a1b96..c1cbceb90 100644 --- a/src/views/messages/container.jsx +++ b/src/views/messages/container.jsx @@ -145,10 +145,18 @@ var Messages = React.createClass({ loadMore = false; } + var adminMessagesLength = this.props.adminMessages.length; + if (Object.keys(this.props.invite).length > 0) { + adminMessagesLength = adminMessagesLength + 1; + } + var numNewSocialMessages = this.props.numNewMessages - adminMessagesLength; + if (numNewSocialMessages < 0) { + numNewSocialMessages = 0; + } var messages = this.filterMessages( this.props.messages, this.state.filterValues, - this.props.numNewMessages + numNewSocialMessages ); return( @@ -158,7 +166,8 @@ var Messages = React.createClass({ messages={messages} adminMessages={this.props.adminMessages} scratcherInvite={this.props.invite} - numNewMessages={this.props.numNewMessages} + numNewMessages={numNewSocialMessages} + adminMessagesLength={adminMessagesLength} handleFilterClick={this.handleFilterClick} handleAdminDismiss={this.handleMessageDismiss} loadMore={loadMore} diff --git a/src/views/messages/presentation.jsx b/src/views/messages/presentation.jsx index 5043b3011..1cc805f1e 100644 --- a/src/views/messages/presentation.jsx +++ b/src/views/messages/presentation.jsx @@ -209,6 +209,7 @@ var MessagesPresentation = injectIntl(React.createClass({ adminMessages: React.PropTypes.array.isRequired, scratcherInvite: React.PropTypes.object.isRequired, numNewMessages: React.PropTypes.number, + adminMessagesLength: React.PropTypes.number, handleFilterClick: React.PropTypes.func.isRequired, handleAdminDismiss: React.PropTypes.func.isRequired, loadMore: React.PropTypes.bool.isRequired, @@ -218,19 +219,11 @@ var MessagesPresentation = injectIntl(React.createClass({ getDefaultProps: function () { return { numNewMessages: 0, + adminMessagesLength: 0, filterOpen: false }; }, render: function () { - var adminMessageLength = this.props.adminMessages.length; - if (Object.keys(this.props.scratcherInvite).length > 0) { - adminMessageLength = adminMessageLength + 1; - } - var numNewSocialMessages = this.props.numNewMessages - adminMessageLength; - if (numNewSocialMessages < 0) { - numNewSocialMessages = 0; - } - return (
@@ -278,7 +271,7 @@ var MessagesPresentation = injectIntl(React.createClass({

- +

@@ -318,7 +311,7 @@ var MessagesPresentation = injectIntl(React.createClass({