Fix bug where avatar change not reflected in LLP

Fixes vector-im/riot-web#6189
This commit is contained in:
Luke Barnard 2018-03-01 14:40:03 +00:00
parent 1ac62a17ff
commit 4037a22492
3 changed files with 48 additions and 11 deletions

View file

@ -29,6 +29,7 @@ import classnames from 'classnames';
import GroupStoreCache from '../../stores/GroupStoreCache';
import GroupStore from '../../stores/GroupStore';
import FlairStore from '../../stores/FlairStore';
import { showGroupAddRoomDialog } from '../../GroupAddressPicker';
import GeminiScrollbar from 'react-gemini-scrollbar';
import {makeGroupPermalink, makeUserPermalink} from "../../matrix-to";
@ -429,6 +430,7 @@ export default React.createClass({
editing: false,
saving: false,
uploadingAvatar: false,
avatarChanged: false,
membershipBusy: false,
publicityBusy: false,
inviterProfile: null,
@ -590,6 +592,10 @@ export default React.createClass({
this.setState({
uploadingAvatar: false,
profileForm: newProfileForm,
// Indicate that FlairStore needs to be poked to show this change
// in TagTile (TagPanel), Flair and GroupTile (MyGroups).
avatarChanged: true,
});
}).catch((e) => {
this.setState({uploadingAvatar: false});
@ -615,6 +621,11 @@ export default React.createClass({
});
dis.dispatch({action: 'panel_disable'});
this._initGroupStore(this.props.groupId);
if (this.state.avatarChanged) {
// XXX: Evil - poking a store should be done from an async action
FlairStore.refreshGroupProfile(this._matrixClient, this.props.groupId);
}
}).catch((e) => {
this.setState({
saving: false,
@ -625,6 +636,10 @@ export default React.createClass({
title: _t('Error'),
description: _t('Failed to update community'),
});
}).finally(() => {
this.setState({
avatarChanged: false,
});
}).done();
},