mirror of https://github.com/vector-im/riot-web
move RoomSubList.refreshHeader to apply to the whole RoomSubList again
parent
a8daa53a5b
commit
acbc3e9f9b
|
@ -73,9 +73,6 @@ var RoomSubList = React.createClass({
|
||||||
|
|
||||||
order: React.PropTypes.string.isRequired,
|
order: React.PropTypes.string.isRequired,
|
||||||
|
|
||||||
// undefined if no room is selected (eg we are showing settings)
|
|
||||||
selectedRoom: React.PropTypes.string,
|
|
||||||
|
|
||||||
startAsHidden: React.PropTypes.bool,
|
startAsHidden: React.PropTypes.bool,
|
||||||
showSpinner: React.PropTypes.bool, // true to show a spinner if 0 elements when expanded
|
showSpinner: React.PropTypes.bool, // true to show a spinner if 0 elements when expanded
|
||||||
collapsed: React.PropTypes.bool.isRequired, // is LeftPanel collapsed?
|
collapsed: React.PropTypes.bool.isRequired, // is LeftPanel collapsed?
|
||||||
|
@ -104,12 +101,14 @@ var RoomSubList = React.createClass({
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
constantTimeDispatcher.register("RoomSubList.sort", this.props.tagName, this.onSort);
|
constantTimeDispatcher.register("RoomSubList.sort", this.props.tagName, this.onSort);
|
||||||
|
constantTimeDispatcher.register("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh);
|
||||||
this.sortList(this.applySearchFilter(this.props.list, this.props.searchFilter), this.props.order);
|
this.sortList(this.applySearchFilter(this.props.list, this.props.searchFilter), this.props.order);
|
||||||
this._fixUndefinedOrder(this.props.list);
|
this._fixUndefinedOrder(this.props.list);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
constantTimeDispatcher.unregister("RoomSubList.sort", this.props.tagName, this.onSort);
|
constantTimeDispatcher.unregister("RoomSubList.sort", this.props.tagName, this.onSort);
|
||||||
|
constantTimeDispatcher.unregister("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
componentWillReceiveProps: function(newProps) {
|
||||||
|
@ -124,6 +123,10 @@ var RoomSubList = React.createClass({
|
||||||
// we deliberately don't waste time trying to fix undefined ordering here
|
// we deliberately don't waste time trying to fix undefined ordering here
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onRefresh: function() {
|
||||||
|
this.forceUpdate();
|
||||||
|
},
|
||||||
|
|
||||||
applySearchFilter: function(list, filter) {
|
applySearchFilter: function(list, filter) {
|
||||||
if (filter === "") return list;
|
if (filter === "") return list;
|
||||||
return list.filter((room) => {
|
return list.filter((room) => {
|
||||||
|
@ -370,7 +373,6 @@ var RoomSubList = React.createClass({
|
||||||
var self = this;
|
var self = this;
|
||||||
var DNDRoomTile = sdk.getComponent("rooms.DNDRoomTile");
|
var DNDRoomTile = sdk.getComponent("rooms.DNDRoomTile");
|
||||||
return this.state.sortedList.map(function(room) {
|
return this.state.sortedList.map(function(room) {
|
||||||
var selected = room.roomId == self.props.selectedRoom;
|
|
||||||
// XXX: is it evil to pass in self as a prop to RoomTile?
|
// XXX: is it evil to pass in self as a prop to RoomTile?
|
||||||
return (
|
return (
|
||||||
<DNDRoomTile
|
<DNDRoomTile
|
||||||
|
@ -378,9 +380,6 @@ var RoomSubList = React.createClass({
|
||||||
roomSubList={ self }
|
roomSubList={ self }
|
||||||
key={ room.roomId }
|
key={ room.roomId }
|
||||||
collapsed={ self.props.collapsed || false}
|
collapsed={ self.props.collapsed || false}
|
||||||
selected={ selected }
|
|
||||||
unread={ Unread.doesRoomHaveUnreadMessages(room) }
|
|
||||||
highlight={ room.getUnreadNotificationCount('highlight') > 0 || self.props.label === 'Invites' }
|
|
||||||
isInvite={ self.props.label === 'Invites' }
|
isInvite={ self.props.label === 'Invites' }
|
||||||
refreshSubList={ self._updateSubListCount }
|
refreshSubList={ self._updateSubListCount }
|
||||||
incomingCall={ null }
|
incomingCall={ null }
|
||||||
|
|
|
@ -50,16 +50,16 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
constantTimeDispatcher.register("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh);
|
// constantTimeDispatcher.register("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
constantTimeDispatcher.unregister("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh);
|
// constantTimeDispatcher.unregister("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh);
|
||||||
},
|
},
|
||||||
|
|
||||||
onRefresh: function() {
|
// onRefresh: function() {
|
||||||
this.forceUpdate();
|
// this.forceUpdate();
|
||||||
},
|
// },
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var TintableSvg = sdk.getComponent("elements.TintableSvg");
|
var TintableSvg = sdk.getComponent("elements.TintableSvg");
|
||||||
|
|
Loading…
Reference in New Issue