Fix self invite

This commit is contained in:
Natsumi
2022-07-30 00:24:20 +12:00
parent 97cbeaff4b
commit 486ce95fd4
2 changed files with 18 additions and 10 deletions

View File

@@ -766,9 +766,9 @@ speechSynthesis.getVoices();
},
methods: {
parse() {
var L = API.parseLocation(this.location);
this.$el.style.display =
L.isOffline || L.isPrivate || L.isTraveling ? 'none' : '';
this.$el.style.display = $app.checkCanInviteSelf()
? 'none'
: '';
},
confirm() {
API.$emit('SHOW_LAUNCH_DIALOG', this.location);
@@ -792,9 +792,9 @@ speechSynthesis.getVoices();
},
methods: {
parse() {
var L = API.parseLocation(this.location);
this.$el.style.display =
L.isOffline || L.isPrivate || L.isTraveling ? 'none' : '';
this.$el.style.display = $app.checkCanInviteSelf()
? 'none'
: '';
},
confirm() {
var L = API.parseLocation(this.location);
@@ -2017,7 +2017,7 @@ speechSynthesis.getVoices();
*/
API.selfInvite = function (params) {
return this.call(
`instances/${params.worldId}:${params.instanceId}/invite`,
`invite/myself/to/${params.worldId}:${params.instanceId}`,
{
method: 'POST'
}
@@ -18600,6 +18600,14 @@ speechSynthesis.getVoices();
};
$app.methods.checkCanInvite = function (location) {
var L = API.parseLocation(location);
if (L.accessType === 'public' || L.userId === API.currentUser.id) {
return true;
}
return false;
};
$app.methods.checkCanInviteSelf = function (location) {
var L = API.parseLocation(location);
if (L.accessType === 'invite' || L.accessType === 'friends') {
if (L.userId === API.currentUser.id) {