|
@@ -1167,7 +1167,7 @@ export class WebClientService {
|
|
|
const data = {
|
|
|
[WebClientService.ARGUMENT_MEMBERS]: members,
|
|
|
[WebClientService.ARGUMENT_NAME]: name,
|
|
|
- } as any;
|
|
|
+ } as object;
|
|
|
|
|
|
if (avatar !== undefined) {
|
|
|
data[WebClientService.ARGUMENT_AVATAR_HIGH_RESOLUTION] = avatar;
|
|
@@ -1178,26 +1178,27 @@ export class WebClientService {
|
|
|
|
|
|
public modifyGroup(id: string,
|
|
|
members: string[],
|
|
|
- name: string = null,
|
|
|
+ name?: string,
|
|
|
avatar?: ArrayBuffer): Promise<threema.GroupReceiver> {
|
|
|
- const data = {
|
|
|
- [WebClientService.ARGUMENT_MEMBERS]: members,
|
|
|
- [WebClientService.ARGUMENT_NAME]: name,
|
|
|
- } as any;
|
|
|
-
|
|
|
+ // Prepare payload data
|
|
|
+ const data = {};
|
|
|
+ data[WebClientService.ARGUMENT_MEMBERS] = members;
|
|
|
+ if (name !== undefined) {
|
|
|
+ data[WebClientService.ARGUMENT_NAME] = name;
|
|
|
+ }
|
|
|
if (avatar !== undefined) {
|
|
|
data[WebClientService.ARGUMENT_AVATAR_HIGH_RESOLUTION] = avatar;
|
|
|
}
|
|
|
- const promise = this._sendUpdatePromise(WebClientService.SUB_TYPE_GROUP, {
|
|
|
+
|
|
|
+ // Send update
|
|
|
+ const args = {
|
|
|
[WebClientService.ARGUMENT_RECEIVER_ID]: id,
|
|
|
- }, data);
|
|
|
+ };
|
|
|
+ const promise = this._sendUpdatePromise(WebClientService.SUB_TYPE_GROUP, args, data);
|
|
|
|
|
|
+ // If necessary, reset avatar to force a avatar reload
|
|
|
if (avatar !== undefined) {
|
|
|
- // reset avatar to force a avatar reload
|
|
|
- this.receivers.getData({
|
|
|
- type: 'group',
|
|
|
- id: id,
|
|
|
- } as threema.GroupReceiver).avatar = {};
|
|
|
+ this.groups.get(id).avatar = {};
|
|
|
}
|
|
|
return promise;
|
|
|
}
|
|
@@ -1809,7 +1810,7 @@ export class WebClientService {
|
|
|
}
|
|
|
|
|
|
const data = message.data;
|
|
|
- if ( data === undefined) {
|
|
|
+ if (data === undefined) {
|
|
|
// It's ok, a receiver without a avatar
|
|
|
return {
|
|
|
success: true,
|