diff --git a/html/src/app.js b/html/src/app.js index 4ce64aa1..d0616aab 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -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) { diff --git a/html/src/index.pug b/html/src/index.pug index 74a33b15..d69890e5 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -704,7 +704,7 @@ html el-tooltip(placement="top" content="Decline with message" :disabled="hideTooltips") el-button(type="text" icon="el-icon-chat-line-square" size="mini" @click="showSendInviteResponseDialog(scope.row)") template(v-else-if="scope.row.type === 'requestInvite'") - template(v-if="lastLocation.location && isGameRunning && !checkCanInvite(lastLocation.location)") + template(v-if="lastLocation.location && isGameRunning && checkCanInvite(lastLocation.location)") el-tooltip(placement="top" content="Invite" :disabled="hideTooltips") el-button(type="text" icon="el-icon-check" size="mini" @click="acceptRequestInvite(scope.row)") el-tooltip(placement="top" content="Decline with message" :disabled="hideTooltips") @@ -1483,7 +1483,7 @@ html template(v-if="userDialog.isFriend") el-dropdown-item(icon="el-icon-postcard" command="Request Invite" divided) Request Invite el-dropdown-item(icon="el-icon-postcard" command="Request Invite Message") Request Invite With Message - template(v-if="lastLocation.location && isGameRunning && !checkCanInvite(lastLocation.location)") + template(v-if="lastLocation.location && isGameRunning && checkCanInvite(lastLocation.location)") el-dropdown-item(icon="el-icon-message" command="Invite") Invite el-dropdown-item(icon="el-icon-message" command="Invite Message") Invite With Message template(v-else-if="userDialog.incomingRequest") @@ -2255,7 +2255,7 @@ html template(#footer) el-checkbox(v-model="launchDialog.desktop" style="float:left;margin-top:5px") Start as Desktop (No VR) el-button(size="small" @click="showPreviousInstanceInfoDialog(launchDialog.location)") Info - el-button(size="small" @click="showInviteDialog(launchDialog.location)" :disabled="checkCanInvite(launchDialog.location)") Invite + el-button(size="small" @click="showInviteDialog(launchDialog.location)" :disabled="!checkCanInvite(launchDialog.location)") Invite el-button(type="primary" size="small" @click="launchGame(locationToLaunchArg(launchDialog.location))") Launch //- dialog: export friends list