no need for self

This commit is contained in:
Bruno Windels 2018-10-19 14:43:54 +02:00
parent d48f19bc19
commit c6924c47fa

View file

@ -443,14 +443,11 @@ module.exports = React.createClass({
render: function() { render: function() {
const RoomSubList = sdk.getComponent('structures.RoomSubList'); const RoomSubList = sdk.getComponent('structures.RoomSubList');
const mapProps = (subListsProps) => {
const self = this;
function mapProps(subListsProps) {
const defaultProps = { const defaultProps = {
collapsed: self.props.collapsed, collapsed: this.props.collapsed,
searchFilter: self.props.searchFilter, searchFilter: this.props.searchFilter,
incomingCall: self.state.incomingCall, incomingCall: this.state.incomingCall,
}; };
return subListsProps.reduce((components, props, i) => { return subListsProps.reduce((components, props, i) => {
props = Object.assign({}, defaultProps, props); props = Object.assign({}, defaultProps, props);
@ -478,25 +475,25 @@ module.exports = React.createClass({
let subLists = [ let subLists = [
{ {
list: [], list: [],
extraTiles: this._makeGroupInviteTiles(self.props.searchFilter), extraTiles: this._makeGroupInviteTiles(this.props.searchFilter),
label: _t('Community Invites'), label: _t('Community Invites'),
order: "recent", order: "recent",
isInvite: true, isInvite: true,
}, },
{ {
list: self.state.lists['im.vector.fake.invite'], list: this.state.lists['im.vector.fake.invite'],
label: _t('Invites'), label: _t('Invites'),
order: "recent", order: "recent",
isInvite: true, isInvite: true,
}, },
{ {
list: self.state.lists['m.favourite'], list: this.state.lists['m.favourite'],
label: _t('Favourites'), label: _t('Favourites'),
tagName: "m.favourite", tagName: "m.favourite",
order: "manual", order: "manual",
}, },
{ {
list: self.state.lists['im.vector.fake.direct'], list: this.state.lists['im.vector.fake.direct'],
label: _t('People'), label: _t('People'),
tagName: "im.vector.fake.direct", tagName: "im.vector.fake.direct",
headerItems: this._getHeaderItems('im.vector.fake.direct'), headerItems: this._getHeaderItems('im.vector.fake.direct'),
@ -504,19 +501,19 @@ module.exports = React.createClass({
onAddRoom: () => {dis.dispatch({action: 'view_create_chat'})}, onAddRoom: () => {dis.dispatch({action: 'view_create_chat'})},
}, },
{ {
list: self.state.lists['im.vector.fake.recent'], list: this.state.lists['im.vector.fake.recent'],
label: _t('Rooms'), label: _t('Rooms'),
headerItems: this._getHeaderItems('im.vector.fake.recent'), headerItems: this._getHeaderItems('im.vector.fake.recent'),
order: "recent", order: "recent",
onAddRoom: () => {dis.dispatch({action: 'view_create_room'})}, onAddRoom: () => {dis.dispatch({action: 'view_create_room'})},
}, },
]; ];
const tagSubLists = Object.keys(self.state.lists) const tagSubLists = Object.keys(this.state.lists)
.filter((tagName) => { .filter((tagName) => {
return !tagName.match(STANDARD_TAGS_REGEX); return !tagName.match(STANDARD_TAGS_REGEX);
}).map((tagName) => { }).map((tagName) => {
return { return {
list: self.state.lists[tagName], list: this.state.lists[tagName],
key: tagName, key: tagName,
label: labelForTagName(tagName), label: labelForTagName(tagName),
tagName: tagName, tagName: tagName,
@ -526,21 +523,21 @@ module.exports = React.createClass({
subLists = subLists.concat(tagSubLists); subLists = subLists.concat(tagSubLists);
subLists = subLists.concat([ subLists = subLists.concat([
{ {
list: self.state.lists['m.lowpriority'], list: this.state.lists['m.lowpriority'],
label: _t('Low priority'), label: _t('Low priority'),
tagName: "m.lowpriority", tagName: "m.lowpriority",
order: "recent", order: "recent",
}, },
{ {
list: self.state.lists['im.vector.fake.archived'], list: this.state.lists['im.vector.fake.archived'],
label: _t('Historical'), label: _t('Historical'),
order: "recent", order: "recent",
startAsHidden: true, startAsHidden: true,
showSpinner: self.state.isLoadingLeftRooms, showSpinner: this.state.isLoadingLeftRooms,
onHeaderClick: self.onArchivedHeaderClick, onHeaderClick: this.onArchivedHeaderClick,
}, },
{ {
list: self.state.lists['m.server_notice'], list: this.state.lists['m.server_notice'],
label: _t('System Alerts'), label: _t('System Alerts'),
tagName: "m.lowpriority", tagName: "m.lowpriority",
order: "recent", order: "recent",