Limit group invites to 1 user at a time

This commit is contained in:
Natsumi
2022-12-17 18:08:18 +13:00
parent 9ec7dbbe55
commit dc77363c3f
2 changed files with 26 additions and 17 deletions

View File

@@ -23812,7 +23812,7 @@ speechSynthesis.getVoices();
groupId: '',
groupName: '',
userId: '',
userIds: [],
userIds: '',
userObject: {},
groups: []
};
@@ -23820,7 +23820,7 @@ speechSynthesis.getVoices();
$app.methods.showInviteGroupDialog = function (groupId, userId) {
this.$nextTick(() => adjustDialogZ(this.$refs.inviteGroupDialog.$el));
var D = this.inviteGroupDialog;
D.userIds = [];
D.userIds = '';
D.groups = [];
D.groupId = groupId;
D.groupName = groupId;
@@ -23849,7 +23849,8 @@ speechSynthesis.getVoices();
API.getCachedUser({userId}).then((args) => {
D.userObject = args.ref;
});
D.userIds = [userId];
// D.userIds = [userId];
D.userIds = userId;
}
};
@@ -23868,18 +23869,25 @@ speechSynthesis.getVoices();
return;
}
D.loading = true;
var inviteLoop = () => {
if (D.userIds.length > 0) {
var receiverUserId = D.userIds.shift();
API.sendGroupInvite({
groupId: D.groupId,
userId: receiverUserId
}).finally(inviteLoop);
} else {
D.loading = false;
}
};
inviteLoop();
// no fun allowed
// var inviteLoop = () => {
// if (D.userIds.length > 0) {
// var receiverUserId = D.userIds.shift();
// API.sendGroupInvite({
// groupId: D.groupId,
// userId: receiverUserId
// }).finally(inviteLoop);
// } else {
// D.loading = false;
// }
// };
var receiverUserId = D.userIds;
API.sendGroupInvite({
groupId: D.groupId,
userId: receiverUserId
}).finally(() => {
D.loading = false;
});
}
});
};