From 3bbff627fc1a4ae01246466fb51aa5578308cab4 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 17 Oct 2017 17:26:34 +0100 Subject: [PATCH] Fix bug preventing partial group profile When updating the group profile, send empty strings instead of `null` as synapse does not expect `null`. --- src/components/structures/GroupView.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index c9cc375563..cba50a9ef4 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -524,8 +524,15 @@ export default React.createClass({ }, _onSaveClick: function() { + const newGroupProfile = this.state.profileForm; + // Synapse is not expecting `null`, so map unset values to the empty string + Object.keys(newGroupProfile).forEach((k) => { + if (!newGroupProfile[k]) { + newGroupProfile[k] = ''; + } + }); this.setState({saving: true}); - MatrixClientPeg.get().setGroupProfile(this.props.groupId, this.state.profileForm).then((result) => { + MatrixClientPeg.get().setGroupProfile(this.props.groupId, newGroupProfile).then((result) => { this.setState({ saving: false, editing: false,