New Instance and Self Invite

This commit is contained in:
Natsumi
2024-11-15 14:02:32 +13:00
parent 5540acce2d
commit f3a81ba702
4 changed files with 51 additions and 52 deletions
+47 -50
View File
@@ -11259,6 +11259,19 @@ speechSynthesis.getVoices();
case 'New Instance': case 'New Instance':
this.showNewInstanceDialog(D.$location.tag); this.showNewInstanceDialog(D.$location.tag);
break; break;
case 'New Instance and Self Invite':
this.newInstanceDialog.worldId = D.id;
this.createNewInstance().then((args) => {
if (!args?.json?.location) {
this.$message({
message: 'Failed to create instance',
type: 'error'
});
return;
}
this.selfInvite(args.json.location);
});
break;
case 'Add Favorite': case 'Add Favorite':
this.showFavoriteDialog('world', D.id); this.showFavoriteDialog('world', D.id);
break; break;
@@ -12241,16 +12254,28 @@ speechSynthesis.getVoices();
loading: false, loading: false,
selectedTab: '0', selectedTab: '0',
instanceCreated: false, instanceCreated: false,
queueEnabled: false, queueEnabled: await configRepository.getBool(
'instanceDialogQueueEnabled',
true
),
worldId: '', worldId: '',
instanceId: '', instanceId: '',
instanceName: '', instanceName: await configRepository.getString(
userId: '', 'instanceDialogInstanceName',
accessType: '', ''
region: '', ),
userId: await configRepository.getString('instanceDialogUserId', ''),
accessType: await configRepository.getString(
'instanceDialogAccessType',
'public'
),
region: await configRepository.getString('instanceRegion', ''),
groupRegion: '', groupRegion: '',
groupId: '', groupId: await configRepository.getString('instanceDialogGroupId', ''),
groupAccessType: '', groupAccessType: await configRepository.getString(
'instanceDialogGroupAccessType',
'plus'
),
strict: false, strict: false,
location: '', location: '',
shortName: '', shortName: '',
@@ -12372,7 +12397,7 @@ speechSynthesis.getVoices();
this.saveNewInstanceDialog(); this.saveNewInstanceDialog();
}; };
$app.methods.createNewInstance = function () { $app.methods.createNewInstance = async function () {
var D = this.newInstanceDialog; var D = this.newInstanceDialog;
if (D.loading) { if (D.loading) {
return; return;
@@ -12424,19 +12449,20 @@ speechSynthesis.getVoices();
params.canRequestInvite = true; params.canRequestInvite = true;
} }
} }
API.createInstance(params) try {
.then((args) => { var args = await API.createInstance(params);
D.location = args.json.location; D.location = args.json.location;
D.instanceId = args.json.instanceId; D.instanceId = args.json.instanceId;
D.secureOrShortName = D.secureOrShortName = args.json.shortName || args.json.secureName;
args.json.shortName || args.json.secureName; D.instanceCreated = true;
D.instanceCreated = true; this.updateNewInstanceDialog();
this.updateNewInstanceDialog(); D.loading = false;
return args; return args;
}) } catch (err) {
.finally(() => { D.loading = false;
D.loading = false; console.error(err);
}); return null;
}
}; };
$app.methods.selfInvite = function (location, shortName) { $app.methods.selfInvite = function (location, shortName) {
@@ -12502,10 +12528,6 @@ speechSynthesis.getVoices();
'instanceDialogGroupAccessType', 'instanceDialogGroupAccessType',
this.newInstanceDialog.groupAccessType this.newInstanceDialog.groupAccessType
); );
await configRepository.setBool(
'instanceDialogStrict',
this.newInstanceDialog.strict
);
await configRepository.setBool( await configRepository.setBool(
'instanceDialogQueueEnabled', 'instanceDialogQueueEnabled',
this.newInstanceDialog.queueEnabled this.newInstanceDialog.queueEnabled
@@ -12527,31 +12549,6 @@ speechSynthesis.getVoices();
return; return;
} }
D.worldId = L.worldId; D.worldId = L.worldId;
D.accessType = await configRepository.getString(
'instanceDialogAccessType',
'public'
);
D.region = await configRepository.getString(
'instanceRegion',
'US West'
);
D.instanceName = await configRepository.getString(
'instanceDialogInstanceName',
''
);
D.userId = await configRepository.getString('instanceDialogUserId', '');
D.groupId = await configRepository.getString(
'instanceDialogGroupId',
''
);
D.groupAccessType = await configRepository.getString(
'instanceDialogGroupAccessType',
'plus'
);
D.queueEnabled = await configRepository.getBool(
'instanceDialogQueueEnabled',
true
);
D.instanceCreated = false; D.instanceCreated = false;
D.lastSelectedGroupId = ''; D.lastSelectedGroupId = '';
D.selectedGroupRoles = []; D.selectedGroupRoles = [];
+1
View File
@@ -712,6 +712,7 @@
"favorites_tooltip": "Favorites", "favorites_tooltip": "Favorites",
"refresh": "Refresh", "refresh": "Refresh",
"new_instance": "New Instance", "new_instance": "New Instance",
"new_instance_and_self_invite": "New Instance and Self Invite",
"make_home": "Make Home", "make_home": "Make Home",
"reset_home": "Reset Home", "reset_home": "Reset Home",
"show_previous_instances": "Show Previous Instances", "show_previous_instances": "Show Previous Instances",
+1
View File
@@ -53,6 +53,7 @@ mixin worldDialog()
el-dropdown-menu(#default="dropdown") el-dropdown-menu(#default="dropdown")
el-dropdown-item(icon="el-icon-refresh" command="Refresh") {{ $t('dialog.world.actions.refresh') }} el-dropdown-item(icon="el-icon-refresh" command="Refresh") {{ $t('dialog.world.actions.refresh') }}
el-dropdown-item(icon="el-icon-s-flag" command="New Instance" divided) {{ $t('dialog.world.actions.new_instance') }} el-dropdown-item(icon="el-icon-s-flag" command="New Instance" divided) {{ $t('dialog.world.actions.new_instance') }}
el-dropdown-item(icon="el-icon-message" command="New Instance and Self Invite") {{ $t('dialog.world.actions.new_instance_and_self_invite') }}
el-dropdown-item(v-if="API.currentUser.$homeLocation && API.currentUser.$homeLocation.worldId === worldDialog.id" icon="el-icon-magic-stick" command="Reset Home" divided) {{ $t('dialog.world.actions.reset_home') }} el-dropdown-item(v-if="API.currentUser.$homeLocation && API.currentUser.$homeLocation.worldId === worldDialog.id" icon="el-icon-magic-stick" command="Reset Home" divided) {{ $t('dialog.world.actions.reset_home') }}
el-dropdown-item(v-else icon="el-icon-s-home" command="Make Home" divided) {{ $t('dialog.world.actions.make_home') }} el-dropdown-item(v-else icon="el-icon-s-home" command="Make Home" divided) {{ $t('dialog.world.actions.make_home') }}
el-dropdown-item(icon="el-icon-tickets" command="Previous Instances") {{ $t('dialog.world.actions.show_previous_instances') }} el-dropdown-item(icon="el-icon-tickets" command="Previous Instances") {{ $t('dialog.world.actions.show_previous_instances') }}
+2 -2
View File
@@ -50,8 +50,8 @@ mixin notificationsTab()
img.x-link(v-lazy="scope.row.imageUrl" style="width:500px" @click="showFullscreenImageDialog(scope.row.imageUrl)") img.x-link(v-lazy="scope.row.imageUrl" style="width:500px" @click="showFullscreenImageDialog(scope.row.imageUrl)")
el-table-column(:label="$t('table.notification.message')" prop="message") el-table-column(:label="$t('table.notification.message')" prop="message")
template(v-once #default="scope") template(v-once #default="scope")
span.x-link(v-if="scope.row.type === 'invite'" @click="showWorldDialog(scope.row.details.worldId)") span.x-link(v-if="scope.row.type === 'invite'")
location(v-if="scope.row.details" :location="scope.row.details.worldId" :hint="scope.row.details.worldName" :grouphint="scope.row.details.groupName" :link="false") location(v-if="scope.row.details" :location="scope.row.details.worldId" :hint="scope.row.details.worldName" :grouphint="scope.row.details.groupName" :link="true")
br br
span(v-if="scope.row.message && scope.row.message !== `This is a generated invite to ${scope.row.details?.worldName}`" v-text="scope.row.message") span(v-if="scope.row.message && scope.row.message !== `This is a generated invite to ${scope.row.details?.worldName}`" v-text="scope.row.message")
span(v-else-if='scope.row.details && scope.row.details.inviteMessage' v-text="scope.row.details.inviteMessage") span(v-else-if='scope.row.details && scope.row.details.inviteMessage' v-text="scope.row.details.inviteMessage")