Browse Source

When changing contact avatar, re-request low-res avatar

Danilo Bargen 7 years ago
parent
commit
255df5ea41
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/services/webclient.ts

+ 6 - 2
src/services/webclient.ts

@@ -1300,10 +1300,13 @@ export class WebClientService {
             data[WebClientService.ARGUMENT_AVATAR] = avatar;
         }
 
+        // Get contact
+        const contact: threema.ContactReceiver = this.contacts.get(threemaId);
+
         // If no changes happened, resolve the promise immediately.
         if (Object.keys(data).length === 0) {
             this.$log.warn(this.logTag, 'Trying to modify contact without any changes');
-            return Promise.resolve(this.contacts.get(threemaId));
+            return Promise.resolve(contact);
         }
 
         // Send update
@@ -1312,9 +1315,10 @@ export class WebClientService {
         };
         const promise = this._sendUpdatePromise(WebClientService.SUB_TYPE_CONTACT, args, data);
 
-        // If necessary, reset avatar to force a avatar reload
+        // If necessary, force an avatar reload
         if (avatar !== undefined) {
             this.contacts.get(threemaId).avatar = {};
+            this.requestAvatar(contact, false);
         }
 
         return promise;