Invite with message fixes

This commit is contained in:
Natsumi
2021-02-10 21:26:30 +13:00
parent 5c7144ecfb
commit ee61fc455e
+58 -9
View File
@@ -8346,7 +8346,10 @@ speechSynthesis.getVoices();
API.hideNotification({ API.hideNotification({
notificationId: I.invite.id notificationId: I.invite.id
}); });
this.$message('Invite response message sent'); this.$message({
message: 'Invite response message sent',
type: 'success'
});
this.sendInviteResponseDialogVisible = false; this.sendInviteResponseDialogVisible = false;
this.sendInviteRequestResponseDialogVisible = false; this.sendInviteRequestResponseDialogVisible = false;
return args; return args;
@@ -8412,7 +8415,10 @@ speechSynthesis.getVoices();
API.hideNotification({ API.hideNotification({
notificationId: D.invite.id notificationId: D.invite.id
}); });
this.$message('Invite response message sent'); this.$message({
message: 'Invite response message sent',
type: 'success'
});
return args; return args;
}); });
this.sendInviteResponseDialogVisible = false; this.sendInviteResponseDialogVisible = false;
@@ -8502,25 +8508,62 @@ speechSynthesis.getVoices();
}); });
} }
var I = this.sendInviteDialog; var I = this.sendInviteDialog;
var J = this.inviteDialog;
if (J.visible) {
if (this.API.currentUser.status === 'busy' &&
J.userIds.includes(this.API.currentUser.id) === true) {
this.$message({
message: 'You can\'t invite yourself in \'Do Not Disturb\' mode',
type: 'error'
});
return;
}
var inviteLoop = () => {
if (J.userIds.length > 0) {
var receiverUserId = J.userIds.shift();
API.sendInvite({
instanceId: J.worldId,
worldId: J.worldId,
worldName: J.worldName,
messageSlot: slot
}, receiverUserId).finally(inviteLoop);
} else {
J.loading = false;
J.visible = false;
this.$message({
message: 'Invite message sent',
type: 'success'
});
}
};
inviteLoop();
} else {
if (I.messageType === 'invite') { if (I.messageType === 'invite') {
I.params.messageSlot = slot; I.params.messageSlot = slot;
API.sendInvite(I.params, I.userId).catch((err) => { API.sendInvite(I.params, I.userId).catch((err) => {
throw err; throw err;
}).then((args) => { }).then((args) => {
this.$message('Invite message sent'); this.$message({
message: 'Invite message sent',
type: 'success'
});
return args; return args;
}); });
this.sendInviteDialogVisible = false;
} else if (I.messageType === 'requestInvite') { } else if (I.messageType === 'requestInvite') {
I.params.requestSlot = slot; I.params.requestSlot = slot;
API.sendRequestInvite(I.params, I.userId).catch((err) => { API.sendRequestInvite(I.params, I.userId).catch((err) => {
throw err; throw err;
}).then((args) => { }).then((args) => {
this.$message('Request invite message sent'); this.$message({
message: 'Request invite message sent',
type: 'success'
});
return args; return args;
}); });
this.sendInviteRequestDialogVisible = false;
} }
}
this.sendInviteDialogVisible = false;
this.sendInviteRequestDialogVisible = false;
}; };
$app.methods.cancelEditAndSendInvite = function () { $app.methods.cancelEditAndSendInvite = function () {
@@ -8599,7 +8642,7 @@ speechSynthesis.getVoices();
J.loading = false; J.loading = false;
J.visible = false; J.visible = false;
this.$message({ this.$message({
message: 'Invite sent', message: 'Invite message sent',
type: 'success' type: 'success'
}); });
} }
@@ -8611,13 +8654,19 @@ speechSynthesis.getVoices();
API.sendInvite(D.params, D.userId).catch((err) => { API.sendInvite(D.params, D.userId).catch((err) => {
throw err; throw err;
}).then((args) => { }).then((args) => {
this.$message('Invite message sent'); this.$message({
message: 'Invite message sent',
type: 'success'
});
return args; return args;
}); });
} else if (D.messageType === 'requestInvite') { } else if (D.messageType === 'requestInvite') {
D.params.requestSlot = D.messageSlot; D.params.requestSlot = D.messageSlot;
API.sendRequestInvite(D.params, D.userId).then((args) => { API.sendRequestInvite(D.params, D.userId).then((args) => {
this.$message('Request invite message sent'); this.$message({
message: 'Request invite message sent',
type: 'success'
});
return args; return args;
}); });
} }