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
+15 -7
View File
@@ -766,9 +766,9 @@ speechSynthesis.getVoices();
}, },
methods: { methods: {
parse() { parse() {
var L = API.parseLocation(this.location); this.$el.style.display = $app.checkCanInviteSelf()
this.$el.style.display = ? 'none'
L.isOffline || L.isPrivate || L.isTraveling ? 'none' : ''; : '';
}, },
confirm() { confirm() {
API.$emit('SHOW_LAUNCH_DIALOG', this.location); API.$emit('SHOW_LAUNCH_DIALOG', this.location);
@@ -792,9 +792,9 @@ speechSynthesis.getVoices();
}, },
methods: { methods: {
parse() { parse() {
var L = API.parseLocation(this.location); this.$el.style.display = $app.checkCanInviteSelf()
this.$el.style.display = ? 'none'
L.isOffline || L.isPrivate || L.isTraveling ? 'none' : ''; : '';
}, },
confirm() { confirm() {
var L = API.parseLocation(this.location); var L = API.parseLocation(this.location);
@@ -2017,7 +2017,7 @@ speechSynthesis.getVoices();
*/ */
API.selfInvite = function (params) { API.selfInvite = function (params) {
return this.call( return this.call(
`instances/${params.worldId}:${params.instanceId}/invite`, `invite/myself/to/${params.worldId}:${params.instanceId}`,
{ {
method: 'POST' method: 'POST'
} }
@@ -18600,6 +18600,14 @@ speechSynthesis.getVoices();
}; };
$app.methods.checkCanInvite = function (location) { $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); var L = API.parseLocation(location);
if (L.accessType === 'invite' || L.accessType === 'friends') { if (L.accessType === 'invite' || L.accessType === 'friends') {
if (L.userId === API.currentUser.id) { if (L.userId === API.currentUser.id) {
+3 -3
View File
@@ -704,7 +704,7 @@ html
el-tooltip(placement="top" content="Decline with message" :disabled="hideTooltips") 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)") 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-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-tooltip(placement="top" content="Invite" :disabled="hideTooltips")
el-button(type="text" icon="el-icon-check" size="mini" @click="acceptRequestInvite(scope.row)") el-button(type="text" icon="el-icon-check" size="mini" @click="acceptRequestInvite(scope.row)")
el-tooltip(placement="top" content="Decline with message" :disabled="hideTooltips") el-tooltip(placement="top" content="Decline with message" :disabled="hideTooltips")
@@ -1483,7 +1483,7 @@ html
template(v-if="userDialog.isFriend") 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" divided) Request Invite
el-dropdown-item(icon="el-icon-postcard" command="Request Invite Message") Request Invite With Message 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") Invite
el-dropdown-item(icon="el-icon-message" command="Invite Message") Invite With Message el-dropdown-item(icon="el-icon-message" command="Invite Message") Invite With Message
template(v-else-if="userDialog.incomingRequest") template(v-else-if="userDialog.incomingRequest")
@@ -2255,7 +2255,7 @@ html
template(#footer) template(#footer)
el-checkbox(v-model="launchDialog.desktop" style="float:left;margin-top:5px") Start as Desktop (No VR) 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="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 el-button(type="primary" size="small" @click="launchGame(locationToLaunchArg(launchDialog.location))") Launch
//- dialog: export friends list //- dialog: export friends list