mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-04 22:06:06 +02:00
Delete, Rename and Change description of worlds
This commit is contained in:
+143
-9
@@ -1410,6 +1410,31 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
API.$on('WORLD:DELETE', function (args) {
|
||||||
|
var { json } = args;
|
||||||
|
this.cachedWorlds.delete(json.id);
|
||||||
|
if ($app.worldDialog.ref.authorId === json.authorId) {
|
||||||
|
var map = new Map();
|
||||||
|
for (var ref of this.cachedWorlds.values()) {
|
||||||
|
if (ref.authorId === json.authorId) {
|
||||||
|
map.set(ref.id, ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var array = Array.from(map.values());
|
||||||
|
$app.setUserDialogWorlds(array);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
API.$on('WORLD:SAVE', function (args) {
|
||||||
|
var { json } = args;
|
||||||
|
this.$emit('WORLD', {
|
||||||
|
json,
|
||||||
|
params: {
|
||||||
|
worldId: json.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
API.applyWorld = function (json) {
|
API.applyWorld = function (json) {
|
||||||
var ref = this.cachedWorlds.get(json.id);
|
var ref = this.cachedWorlds.get(json.id);
|
||||||
if (typeof ref === 'undefined') {
|
if (typeof ref === 'undefined') {
|
||||||
@@ -1528,6 +1553,43 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
params: {
|
||||||
|
worldId: string
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
API.deleteWorld = function (params) {
|
||||||
|
return this.call(`worlds/${params.worldId}`, {
|
||||||
|
method: 'DELETE'
|
||||||
|
}).then((json) => {
|
||||||
|
var args = {
|
||||||
|
json,
|
||||||
|
params
|
||||||
|
};
|
||||||
|
this.$emit('WORLD:DELETE', args);
|
||||||
|
return args;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
params: {
|
||||||
|
worldId: string
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
API.saveWorld = function (params) {
|
||||||
|
return this.call(`worlds/${params.id}`, {
|
||||||
|
method: 'PUT',
|
||||||
|
params
|
||||||
|
}).then((json) => {
|
||||||
|
var args = {
|
||||||
|
json,
|
||||||
|
params
|
||||||
|
};
|
||||||
|
this.$emit('WORLD:SAVE', args);
|
||||||
|
return args;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// API: Friend
|
// API: Friend
|
||||||
|
|
||||||
API.friends200 = new Set();
|
API.friends200 = new Set();
|
||||||
@@ -1919,8 +1981,7 @@ speechSynthesis.getVoices();
|
|||||||
*/
|
*/
|
||||||
API.deleteAvatar = function (params) {
|
API.deleteAvatar = function (params) {
|
||||||
return this.call(`avatars/${params.avatarId}`, {
|
return this.call(`avatars/${params.avatarId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE'
|
||||||
params
|
|
||||||
}).then((json) => {
|
}).then((json) => {
|
||||||
var args = {
|
var args = {
|
||||||
json,
|
json,
|
||||||
@@ -7369,7 +7430,7 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.promptChangeDescription = function (avatar) {
|
$app.methods.promptChangeAvatarDescription = function (avatar) {
|
||||||
this.$prompt('Enter avatar description', 'Change Description', {
|
this.$prompt('Enter avatar description', 'Change Description', {
|
||||||
distinguishCancelAndClose: true,
|
distinguishCancelAndClose: true,
|
||||||
confirmButtonText: 'OK',
|
confirmButtonText: 'OK',
|
||||||
@@ -7394,6 +7455,56 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$app.methods.promptRenameWorld = function (world) {
|
||||||
|
this.$prompt('Enter world name', 'Rename World', {
|
||||||
|
distinguishCancelAndClose: true,
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
cancelButtonText: 'Cancel',
|
||||||
|
inputValue: world.ref.name,
|
||||||
|
inputErrorMessage: 'Valid name is required',
|
||||||
|
callback: (action, instance) => {
|
||||||
|
if (action === 'confirm' &&
|
||||||
|
instance.inputValue !== world.ref.name) {
|
||||||
|
API.saveWorld({
|
||||||
|
id: world.id,
|
||||||
|
name: instance.inputValue
|
||||||
|
}).then((args) => {
|
||||||
|
this.$message({
|
||||||
|
message: 'World renamed',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
return args;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$app.methods.promptChangeWorldDescription = function (world) {
|
||||||
|
this.$prompt('Enter world description', 'Change Description', {
|
||||||
|
distinguishCancelAndClose: true,
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
cancelButtonText: 'Cancel',
|
||||||
|
inputValue: world.ref.description,
|
||||||
|
inputErrorMessage: 'Valid description is required',
|
||||||
|
callback: (action, instance) => {
|
||||||
|
if (action === 'confirm' &&
|
||||||
|
instance.inputValue !== world.ref.description) {
|
||||||
|
API.saveWorld({
|
||||||
|
id: world.id,
|
||||||
|
description: instance.inputValue
|
||||||
|
}).then((args) => {
|
||||||
|
this.$message({
|
||||||
|
message: 'World description changed',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
return args;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// App: Dialog
|
// App: Dialog
|
||||||
|
|
||||||
var adjustDialogZ = (el) => {
|
var adjustDialogZ = (el) => {
|
||||||
@@ -7834,7 +7945,7 @@ speechSynthesis.getVoices();
|
|||||||
var map = new Map();
|
var map = new Map();
|
||||||
for (var ref of API.cachedWorlds.values()) {
|
for (var ref of API.cachedWorlds.values()) {
|
||||||
if (ref.authorId === D.id) {
|
if (ref.authorId === D.id) {
|
||||||
map.set(ref.id, ref);
|
API.cachedWorlds.delete(ref.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
API.bulk({
|
API.bulk({
|
||||||
@@ -8325,7 +8436,8 @@ speechSynthesis.getVoices();
|
|||||||
if (D.visible === false) {
|
if (D.visible === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (command === 'Refresh') {
|
switch (command) {
|
||||||
|
case 'Refresh':
|
||||||
D.loading = true;
|
D.loading = true;
|
||||||
API.getWorld({
|
API.getWorld({
|
||||||
worldId: D.id
|
worldId: D.id
|
||||||
@@ -8346,11 +8458,20 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
});
|
});
|
||||||
} else if (command === 'New Instance') {
|
break;
|
||||||
|
case 'New Instance':
|
||||||
this.showNewInstanceDialog(D.$location.tag);
|
this.showNewInstanceDialog(D.$location.tag);
|
||||||
} else if (command === 'Add Favorite') {
|
break;
|
||||||
|
case 'Add Favorite':
|
||||||
this.showFavoriteDialog('world', D.id);
|
this.showFavoriteDialog('world', D.id);
|
||||||
} else {
|
break;
|
||||||
|
case 'Rename':
|
||||||
|
this.promptRenameWorld(D);
|
||||||
|
break;
|
||||||
|
case 'Change Description':
|
||||||
|
this.promptChangeWorldDescription(D);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
this.$confirm(`Continue? ${command}`, 'Confirm', {
|
this.$confirm(`Continue? ${command}`, 'Confirm', {
|
||||||
confirmButtonText: 'Confirm',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: 'Cancel',
|
cancelButtonText: 'Cancel',
|
||||||
@@ -8387,11 +8508,24 @@ speechSynthesis.getVoices();
|
|||||||
return args;
|
return args;
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case 'Delete':
|
||||||
|
API.deleteWorld({
|
||||||
|
worldId: D.id
|
||||||
|
}).then((args) => {
|
||||||
|
this.$message({
|
||||||
|
message: 'World has been deleted',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
D.visible = false;
|
||||||
|
return args;
|
||||||
|
});
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -8519,7 +8653,7 @@ speechSynthesis.getVoices();
|
|||||||
this.displayAvatarImages();
|
this.displayAvatarImages();
|
||||||
break;
|
break;
|
||||||
case 'Change Description':
|
case 'Change Description':
|
||||||
this.promptChangeDescription(D);
|
this.promptChangeAvatarDescription(D);
|
||||||
break;
|
break;
|
||||||
case 'Add Favorite':
|
case 'Add Favorite':
|
||||||
this.showFavoriteDialog('avatar', D.id);
|
this.showFavoriteDialog('avatar', D.id);
|
||||||
|
|||||||
@@ -1139,6 +1139,9 @@ html
|
|||||||
el-dropdown-item(icon="el-icon-s-flag" command="New Instance" divided) New Instance
|
el-dropdown-item(icon="el-icon-s-flag" command="New Instance" divided) New Instance
|
||||||
el-dropdown-item(v-if="API.currentUser.$homeLocation && API.currentUser.$homeLocation.worldId === worldDialog.id" icon="el-icon-magic-stick" command="Reset Home" divided) 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) Reset Home
|
||||||
el-dropdown-item(v-else icon="el-icon-s-home" command="Make Home" divided) Make Home
|
el-dropdown-item(v-else icon="el-icon-s-home" command="Make Home" divided) Make Home
|
||||||
|
el-dropdown-item(icon="el-icon-edit" command="Rename") Rename
|
||||||
|
el-dropdown-item(icon="el-icon-edit" command="Change Description") Change Description
|
||||||
|
el-dropdown-item(v-if="API.currentUser.id === worldDialog.ref.authorId" icon="el-icon-delete" command="Delete" style="color:#F56C6C" divided) Delete
|
||||||
el-tabs
|
el-tabs
|
||||||
el-tab-pane(label="Instances")
|
el-tab-pane(label="Instances")
|
||||||
div.
|
div.
|
||||||
|
|||||||
Reference in New Issue
Block a user