From 2b4888d062d65546325470d2d9181f4a66a2fb00 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Mon, 22 Jun 2015 14:23:59 -0400 Subject: fixes mm-1316 improves channel notifications UI and updates channellist etag --- web/react/components/channel_header.jsx | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'web/react/components/channel_header.jsx') diff --git a/web/react/components/channel_header.jsx b/web/react/components/channel_header.jsx index ade58a10a..428d3ed81 100644 --- a/web/react/components/channel_header.jsx +++ b/web/react/components/channel_header.jsx @@ -15,17 +15,8 @@ var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); var Constants = require('../utils/constants.jsx'); var ActionTypes = Constants.ActionTypes; -function getExtraInfoStateFromStores() { - return { - extra_info: ChannelStore.getCurrentExtraInfo() - }; -} - var ExtraMembers = React.createClass({ componentDidMount: function() { - ChannelStore.addExtraInfoChangeListener(this._onChange); - ChannelStore.addChangeListener(this._onChange); - var originalLeave = $.fn.popover.Constructor.prototype.leave; $.fn.popover.Constructor.prototype.leave = function(obj) { var self = obj instanceof this.constructor ? obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type); @@ -49,25 +40,12 @@ var ExtraMembers = React.createClass({ }); }, - componentWillUnmount: function() { - ChannelStore.removeExtraInfoChangeListener(this._onChange); - ChannelStore.removeChangeListener(this._onChange); - }, - _onChange: function() { - var newState = getExtraInfoStateFromStores(); - if (!utils.areStatesEqual(newState, this.state)) { - this.setState(newState); - } - }, - getInitialState: function() { - return getExtraInfoStateFromStores(); - }, render: function() { - var count = this.state.extra_info.members.length == 0 ? "-" : this.state.extra_info.members.length; - count = this.state.extra_info.members.length > 19 ? "20+" : count; + var count = this.props.members.length == 0 ? "-" : this.props.members.length; + count = this.props.members.length > 19 ? "20+" : count; var data_content = ""; - this.state.extra_info.members.forEach(function(m) { + this.props.members.forEach(function(m) { data_content += "
" + m.username + "
"; }); @@ -228,7 +206,7 @@ module.exports = React.createClass({ {channelTitle} } - + { searchForm }
-- cgit v1.2.3-1-g7c22 From 9afbc9c206d12b2d38cf853f37f4ba678bbd1d90 Mon Sep 17 00:00:00 2001 From: nickago Date: Sun, 28 Jun 2015 16:36:19 -0700 Subject: Sorted the channel members popover lexigraphically --- web/react/components/channel_header.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'web/react/components/channel_header.jsx') diff --git a/web/react/components/channel_header.jsx b/web/react/components/channel_header.jsx index 428d3ed81..f4e4078a5 100644 --- a/web/react/components/channel_header.jsx +++ b/web/react/components/channel_header.jsx @@ -44,8 +44,13 @@ var ExtraMembers = React.createClass({ var count = this.props.members.length == 0 ? "-" : this.props.members.length; count = this.props.members.length > 19 ? "20+" : count; var data_content = ""; + var sortedMembers = this.state.extra_info.members - this.props.members.forEach(function(m) { + sortedMembers.sort(function(a,b) { + return a.username.localeCompare(b.username) + }) + + sortedMembers.forEach(function(m) { data_content += "
" + m.username + "
"; }); -- cgit v1.2.3-1-g7c22 From e41e7a27cfe14d6c17a10d4037a11c430cc86e39 Mon Sep 17 00:00:00 2001 From: nickago Date: Mon, 29 Jun 2015 15:27:53 -0700 Subject: Added semicolons --- web/react/components/channel_header.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/react/components/channel_header.jsx') diff --git a/web/react/components/channel_header.jsx b/web/react/components/channel_header.jsx index f4e4078a5..39e3e767a 100644 --- a/web/react/components/channel_header.jsx +++ b/web/react/components/channel_header.jsx @@ -44,10 +44,10 @@ var ExtraMembers = React.createClass({ var count = this.props.members.length == 0 ? "-" : this.props.members.length; count = this.props.members.length > 19 ? "20+" : count; var data_content = ""; - var sortedMembers = this.state.extra_info.members + var sortedMembers = this.state.extra_info.members; sortedMembers.sort(function(a,b) { - return a.username.localeCompare(b.username) + return a.username.localeCompare(b.username); }) sortedMembers.forEach(function(m) { -- cgit v1.2.3-1-g7c22 From 3943d6a209f9119f5732b5e6ec8bdd36cf0566af Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 30 Jun 2015 10:23:46 -0400 Subject: Revert "MM-1289 Sorted the channel members popover lexigraphically" --- web/react/components/channel_header.jsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'web/react/components/channel_header.jsx') diff --git a/web/react/components/channel_header.jsx b/web/react/components/channel_header.jsx index 39e3e767a..428d3ed81 100644 --- a/web/react/components/channel_header.jsx +++ b/web/react/components/channel_header.jsx @@ -44,13 +44,8 @@ var ExtraMembers = React.createClass({ var count = this.props.members.length == 0 ? "-" : this.props.members.length; count = this.props.members.length > 19 ? "20+" : count; var data_content = ""; - var sortedMembers = this.state.extra_info.members; - sortedMembers.sort(function(a,b) { - return a.username.localeCompare(b.username); - }) - - sortedMembers.forEach(function(m) { + this.props.members.forEach(function(m) { data_content += "
" + m.username + "
"; }); -- cgit v1.2.3-1-g7c22 From ab154d50ea67acf7b1afa347ad5f2186369d169d Mon Sep 17 00:00:00 2001 From: nickago Date: Tue, 30 Jun 2015 07:47:46 -0700 Subject: MM-1289 Now sorts users in lexigraphical order in extra members popover --- web/react/components/channel_header.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'web/react/components/channel_header.jsx') diff --git a/web/react/components/channel_header.jsx b/web/react/components/channel_header.jsx index 428d3ed81..cd1fb225a 100644 --- a/web/react/components/channel_header.jsx +++ b/web/react/components/channel_header.jsx @@ -44,8 +44,13 @@ var ExtraMembers = React.createClass({ var count = this.props.members.length == 0 ? "-" : this.props.members.length; count = this.props.members.length > 19 ? "20+" : count; var data_content = ""; + var sortedMembers = this.props.members; - this.props.members.forEach(function(m) { + sortedMembers.sort(function(a,b) { + return a.username.localeCompare(b.username); + }) + + sortedMembers.forEach(function(m) { data_content += "
" + m.username + "
"; }); -- cgit v1.2.3-1-g7c22 From 4022ab5ce0b8f8480ea2a6fb32d68422aa17e90e Mon Sep 17 00:00:00 2001 From: nickago Date: Tue, 30 Jun 2015 07:59:31 -0700 Subject: Added extra precaution to avoid null error --- web/react/components/channel_header.jsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'web/react/components/channel_header.jsx') diff --git a/web/react/components/channel_header.jsx b/web/react/components/channel_header.jsx index cd1fb225a..48cb4d13b 100644 --- a/web/react/components/channel_header.jsx +++ b/web/react/components/channel_header.jsx @@ -46,13 +46,15 @@ var ExtraMembers = React.createClass({ var data_content = ""; var sortedMembers = this.props.members; - sortedMembers.sort(function(a,b) { - return a.username.localeCompare(b.username); - }) - - sortedMembers.forEach(function(m) { - data_content += "
" + m.username + "
"; - }); + if(sortedMembers) { + sortedMembers.sort(function(a,b) { + return a.username.localeCompare(b.username); + }) + + sortedMembers.forEach(function(m) { + data_content += "
" + m.username + "
"; + }); + } return (
-- cgit v1.2.3-1-g7c22