diff --git a/js/modules/loki_app_dot_net_api.js b/js/modules/loki_app_dot_net_api.js index ddb201663..320e16192 100644 --- a/js/modules/loki_app_dot_net_api.js +++ b/js/modules/loki_app_dot_net_api.js @@ -1249,9 +1249,7 @@ class LokiPublicChannelAPI { } if (note.value && note.value.avatar) { const avatarAbsUrl = this.serverAPI.baseServerUrl + note.value.avatar; - console.log('setting', avatarAbsUrl); const { - upgradeMessageSchema, writeNewAttachmentData, deleteAttachmentData, } = window.Signal.Migrations; @@ -1267,18 +1265,22 @@ class LokiPublicChannelAPI { } return ab; } + const buffer = await imageData.buffer(); const newAttributes = await window.Signal.Types.Conversation.maybeUpdateAvatar( this.conversation.attributes, - toArrayBuffer(imageData), + toArrayBuffer(buffer), { writeNewAttachmentData, deleteAttachmentData, } ); - console.log('newAttributes.avatar', newAttributes.avatar); // update group - this.conversation.set(newAttributes); - //this.conversation.setProfileAvatar(newAttributes.avatar); + this.conversation.set('avatar', newAttributes.avatar); + + await window.Signal.Data.updateConversation(this.conversation.id, this.conversation.attributes, { + Conversation: Whisper.Conversation, + }); + this.conversation.trigger('change'); } // is it mutable? // who are the moderators? diff --git a/ts/components/conversation/UpdateGroupNameDialog.tsx b/ts/components/conversation/UpdateGroupNameDialog.tsx index bc4a1a95d..7e923a848 100644 --- a/ts/components/conversation/UpdateGroupNameDialog.tsx +++ b/ts/components/conversation/UpdateGroupNameDialog.tsx @@ -36,6 +36,7 @@ export class UpdateGroupNameDialog extends React.Component { this.onKeyUp = this.onKeyUp.bind(this); this.closeDialog = this.closeDialog.bind(this); this.onFileSelected = this.onFileSelected.bind(this); + this.onGroupNameChanged = this.onGroupNameChanged.bind(this); this.state = { groupName: this.props.groupName,