Favorite avatar by UUID

This commit is contained in:
Natsumi
2021-04-26 08:12:15 +12:00
parent bc10c86df4
commit 7384e250de
2 changed files with 41 additions and 2 deletions

View File

@@ -2585,6 +2585,12 @@ speechSynthesis.getVoices();
});
});
API.$on('FAVORITE:ADD', function (args) {
if ((args.params.type === 'avatar') && (!API.cachedAvatars.has(args.params.favoriteId))) {
this.refreshFavoriteAvatars(args.params.tags);
}
});
API.$on('FAVORITE:DELETE', function (args) {
var ref = this.cachedFavoritesByObjectId.get(args.params.objectId);
if (typeof ref === 'undefined') {
@@ -2742,6 +2748,15 @@ speechSynthesis.getVoices();
}
};
API.refreshFavoriteAvatars = function (tag) {
var params = {
n: 100,
offset: 0,
tag
};
this.getFavoriteAvatars(params);
};
API.refreshFavoriteItems = function () {
var types = {
'world': [0, 'getFavoriteWorlds'],
@@ -2770,7 +2785,7 @@ speechSynthesis.getVoices();
fn,
N,
params: {
n: 50,
n: 100,
offset: 0,
tag
}
@@ -7415,6 +7430,22 @@ speechSynthesis.getVoices();
});
};
$app.methods.promptAddAvatarFavoriteDialog = function () {
this.$prompt('Enter a Avatar ID (UUID)', 'Avatar Favorite', {
distinguishCancelAndClose: true,
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
inputPattern: /\S+/,
inputErrorMessage: 'Avatar ID is required',
callback: (action, instance) => {
if (action === 'confirm' &&
instance.inputValue) {
this.showFavoriteDialog('avatar', instance.inputValue);
}
}
});
};
// App: Dialog
var adjustDialogZ = (el) => {
@@ -8785,6 +8816,14 @@ speechSynthesis.getVoices();
});
};
$app.methods.addFavoriteAvatar = function (ref, group) {
API.addFavorite({
type: 'avatar',
favoriteId: ref.id,
tags: group.name
});
};
$app.methods.showFavoriteDialog = function (type, objectId) {
this.$nextTick(() => adjustDialogZ(this.$refs.favoriteDialog.$el));
var D = this.favoriteDialog;

View File

@@ -449,7 +449,7 @@ html
el-button-group
el-button(size="small" @click="promptUserDialog()") User
el-button(size="small" @click="promptWorldDialog()") World
el-button(size="small" @click="promptAvatarDialog()") Avatar
el-button(size="small" @click="promptAddAvatarFavoriteDialog()") Avatar
div.options-container
span.header Invite Messages
el-tooltip(placement="top")