make download of group avatar work

pull/878/head
Audric Ackermann 6 years ago
parent 6d5aed7de8
commit 60ed8f2972
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1249,9 +1249,7 @@ class LokiPublicChannelAPI {
} }
if (note.value && note.value.avatar) { if (note.value && note.value.avatar) {
const avatarAbsUrl = this.serverAPI.baseServerUrl + note.value.avatar; const avatarAbsUrl = this.serverAPI.baseServerUrl + note.value.avatar;
console.log('setting', avatarAbsUrl);
const { const {
upgradeMessageSchema,
writeNewAttachmentData, writeNewAttachmentData,
deleteAttachmentData, deleteAttachmentData,
} = window.Signal.Migrations; } = window.Signal.Migrations;
@ -1267,18 +1265,22 @@ class LokiPublicChannelAPI {
} }
return ab; return ab;
} }
const buffer = await imageData.buffer();
const newAttributes = await window.Signal.Types.Conversation.maybeUpdateAvatar( const newAttributes = await window.Signal.Types.Conversation.maybeUpdateAvatar(
this.conversation.attributes, this.conversation.attributes,
toArrayBuffer(imageData), toArrayBuffer(buffer),
{ {
writeNewAttachmentData, writeNewAttachmentData,
deleteAttachmentData, deleteAttachmentData,
} }
); );
console.log('newAttributes.avatar', newAttributes.avatar);
// update group // update group
this.conversation.set(newAttributes); this.conversation.set('avatar', newAttributes.avatar);
//this.conversation.setProfileAvatar(newAttributes.avatar);
await window.Signal.Data.updateConversation(this.conversation.id, this.conversation.attributes, {
Conversation: Whisper.Conversation,
});
this.conversation.trigger('change');
} }
// is it mutable? // is it mutable?
// who are the moderators? // who are the moderators?

@ -36,6 +36,7 @@ export class UpdateGroupNameDialog extends React.Component<Props, State> {
this.onKeyUp = this.onKeyUp.bind(this); this.onKeyUp = this.onKeyUp.bind(this);
this.closeDialog = this.closeDialog.bind(this); this.closeDialog = this.closeDialog.bind(this);
this.onFileSelected = this.onFileSelected.bind(this); this.onFileSelected = this.onFileSelected.bind(this);
this.onGroupNameChanged = this.onGroupNameChanged.bind(this);
this.state = { this.state = {
groupName: this.props.groupName, groupName: this.props.groupName,

Loading…
Cancel
Save