Prevent auto invite attempts when not allowed to (#820)

* Prevent auto invite attempts when not allowed to

Prevent the application from trying to auto invite the user to the instance when the local user does not have permissions to invite to the instance.

* Add try catch to auto invite block

Add try catch to auto invite block to prevent error messages from popping up when they shouldn't
This commit is contained in:
Nekromateion
2024-06-26 13:28:54 +02:00
committed by GitHub
parent c63bd5da00
commit 043ad5ed59

View File

@@ -14889,7 +14889,6 @@ speechSynthesis.getVoices();
currentLocation = $app.lastLocationDestination;
}
if (!currentLocation) return;
var L = this.parseLocation(currentLocation);
if (
$app.autoAcceptInviteRequests === 'All Favorites' &&
!$app.favoriteFriends.some((x) => x.id === ref.senderUserId)
@@ -14902,22 +14901,31 @@ speechSynthesis.getVoices();
)
return;
this.getCachedWorld({
worldId: L.worldId
}).then((args1) => {
this.sendInvite(
{
instanceId: L.tag,
worldId: L.tag,
worldName: args1.ref.name,
rsvp: true
},
ref.senderUserId
).then((_args) => {
$app.$message(`Auto invite sent to ${ref.senderUsername}`);
return _args;
if (!this.checkCanInvite(currentLocation))
return;
var L = this.parseLocation(currentLocation);
try {
this.getCachedWorld({
worldId: L.worldId
}).then((args1) => {
this.sendInvite(
{
instanceId: L.tag,
worldId: L.tag,
worldName: args1.ref.name,
rsvp: true
},
ref.senderUserId
).then((_args) => {
$app.$message(`Auto invite sent to ${ref.senderUsername}`);
return _args;
});
});
});
} catch (err) {
console.error(err);
}
});
$app.data.unseenNotifications = [];