Renames for clarification

This commit is contained in:
Luke Barnard 2017-11-28 15:40:36 +00:00
parent 3addb924b1
commit b748c62880

View file

@ -38,7 +38,7 @@ export default React.createClass({
getInitialState() { getInitialState() {
return { return {
groups: null, userGroups: null,
relatedGroups: [], relatedGroups: [],
}; };
}, },
@ -49,9 +49,9 @@ export default React.createClass({
FlairStore.getPublicisedGroupsCached( FlairStore.getPublicisedGroupsCached(
this.context.matrixClient, this.props.mxEvent.getSender(), this.context.matrixClient, this.props.mxEvent.getSender(),
).then((groups) => { ).then((userGroups) => {
if (this.unmounted) return; if (this.unmounted) return;
this.setState({groups}); this.setState({userGroups});
}); });
this.context.matrixClient.on('RoomState.events', this.onRoomStateEvents); this.context.matrixClient.on('RoomState.events', this.onRoomStateEvents);
@ -93,16 +93,16 @@ export default React.createClass({
return <span />; // emote message must include the name so don't duplicate it return <span />; // emote message must include the name so don't duplicate it
} }
let groups = this.state.groups || []; let displayedGroups = this.state.userGroups || [];
if (this.state.relatedGroups && this.state.relatedGroups.length > 0) { if (this.state.relatedGroups && this.state.relatedGroups.length > 0) {
groups = groups.filter((groupId) => { displayedGroups = displayedGroups.filter((groupId) => {
return this.state.relatedGroups.includes(groupId); return this.state.relatedGroups.includes(groupId);
}); });
} else { } else {
groups = []; displayedGroups = [];
} }
name = groups.length > 0 ? name.replace(' (IRC)', '') : name; name = displayedGroups.length > 0 ? name.replace(' (IRC)', '') : name;
const nameElem = <EmojiText key='name'>{ name || '' }</EmojiText>; const nameElem = <EmojiText key='name'>{ name || '' }</EmojiText>;
@ -114,7 +114,7 @@ export default React.createClass({
{ this.props.enableFlair ? { this.props.enableFlair ?
<Flair key='flair' <Flair key='flair'
userId={mxEvent.getSender()} userId={mxEvent.getSender()}
groups={groups} groups={displayedGroups}
/> />
: null : null
} }