Fix select avatar

This commit is contained in:
Natsumi
2025-07-16 07:31:38 +12:00
parent 4b7ebfc1eb
commit 0ab0378678
6 changed files with 25 additions and 34 deletions
-7
View File
@@ -140,13 +140,6 @@ const userReq = {
}); });
}, },
/**
* @typedef {{
* status: 'active' | 'offline' | 'busy' | 'ask me' | 'join me',
* statusDescription: string
* }} SaveCurrentUserParameters
*/
/** /**
* Updates current user's status. * Updates current user's status.
* @type {import('../types/user').getCurrentUser} * @type {import('../types/user').getCurrentUser}
@@ -263,7 +263,7 @@
circle circle
:disabled="currentUser.currentAvatar === avatarDialog.id" :disabled="currentUser.currentAvatar === avatarDialog.id"
style="margin-left: 5px" style="margin-left: 5px"
@click="selectAvatar(avatarDialog.id)"></el-button> @click="selectAvatarWithoutConfirmation(avatarDialog.id)"></el-button>
</el-tooltip> </el-tooltip>
<el-dropdown <el-dropdown
trigger="click" trigger="click"
@@ -644,7 +644,8 @@
const { showUserDialog, sortUserDialogAvatars } = useUserStore(); const { showUserDialog, sortUserDialogAvatars } = useUserStore();
const { userDialog, currentUser } = storeToRefs(useUserStore()); const { userDialog, currentUser } = storeToRefs(useUserStore());
const { avatarDialog, cachedAvatarModerations, cachedAvatars, cachedAvatarNames } = storeToRefs(useAvatarStore()); const { avatarDialog, cachedAvatarModerations, cachedAvatars, cachedAvatarNames } = storeToRefs(useAvatarStore());
const { showAvatarDialog, getAvatarGallery, applyAvatarModeration, applyAvatar } = useAvatarStore(); const { showAvatarDialog, getAvatarGallery, applyAvatarModeration, applyAvatar, selectAvatarWithoutConfirmation } =
useAvatarStore();
const { showFavoriteDialog } = useFavoriteStore(); const { showFavoriteDialog } = useFavoriteStore();
const { isGameRunning } = storeToRefs(useGameStore()); const { isGameRunning } = storeToRefs(useGameStore());
const { deleteVRChatCache } = useGameStore(); const { deleteVRChatCache } = useGameStore();
@@ -1006,20 +1007,6 @@
}); });
} }
function selectAvatar(id) {
avatarRequest
.selectAvatar({
avatarId: id
})
.then((args) => {
$message({
message: 'Avatar changed',
type: 'success'
});
return args;
});
}
function promptChangeAvatarDescription(avatar) { function promptChangeAvatarDescription(avatar) {
$prompt(t('prompt.change_avatar_description.description'), t('prompt.change_avatar_description.header'), { $prompt(t('prompt.change_avatar_description.description'), t('prompt.change_avatar_description.header'), {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
+7 -7
View File
@@ -610,16 +610,15 @@ export const useAvatarStore = defineStore('Avatar', () => {
}); });
return; return;
} }
avatarRequest return avatarRequest
.selectAvatar({ .selectAvatar({
avatarId: id avatarId: id
}) })
.then((args) => { .then(() => {
new Noty({ $app.$message({
type: 'success', message: 'Avatar changed',
text: 'Avatar changed via launch command' type: 'success'
}).show(); });
return args;
}); });
} }
@@ -722,6 +721,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
getAvatarName, getAvatarName,
lookupAvatars, lookupAvatars,
selectAvatarWithConfirmation, selectAvatarWithConfirmation,
selectAvatarWithoutConfirmation,
showAvatarAuthorDialog, showAvatarAuthorDialog,
addAvatarWearTime addAvatarWearTime
}; };
+4 -1
View File
@@ -1943,7 +1943,7 @@ export const useUserStore = defineStore('User', () => {
last_platform: json.last_platform, last_platform: json.last_platform,
// location - missing from currentUser // location - missing from currentUser
// note - missing from currentUser // note - missing from currentUser
platform: json.presence.platform, // platform - not always present
profilePicOverride: json.profilePicOverride, profilePicOverride: json.profilePicOverride,
profilePicOverrideThumbnail: json.profilePicOverrideThumbnail, profilePicOverrideThumbnail: json.profilePicOverrideThumbnail,
pronouns: json.pronouns, pronouns: json.pronouns,
@@ -1976,6 +1976,9 @@ export const useUserStore = defineStore('User', () => {
userRef.$offline_for = state.currentUser.$offline_for; userRef.$offline_for = state.currentUser.$offline_for;
userRef.$location_at = state.currentUser.$location_at; userRef.$location_at = state.currentUser.$location_at;
userRef.$travelingToTime = state.currentUser.$travelingToTime; userRef.$travelingToTime = state.currentUser.$travelingToTime;
if (json.presence?.platform) {
userRef.platform = json.presence.platform;
}
return ref; return ref;
} }
+9 -1
View File
@@ -30,6 +30,7 @@ import { useUpdateLoopStore } from './updateLoop';
import { useUserStore } from './user'; import { useUserStore } from './user';
import { useWorldStore } from './world'; import { useWorldStore } from './world';
import { useI18n } from 'vue-i18n-bridge'; import { useI18n } from 'vue-i18n-bridge';
import Noty from 'noty';
export const useVrcxStore = defineStore('Vrcx', () => { export const useVrcxStore = defineStore('Vrcx', () => {
const gameStore = useGameStore(); const gameStore = useGameStore();
@@ -617,7 +618,14 @@ export const useVrcxStore = defineStore('Vrcx', () => {
// Makes sure the window is focused // Makes sure the window is focused
shouldFocusWindow = true; shouldFocusWindow = true;
} else { } else {
$app.selectAvatarWithoutConfirmation(avatarId); avatarStore
.selectAvatarWithoutConfirmation(avatarId)
.then(() => {
new Noty({
type: 'success',
text: 'Avatar changed via launch command'
}).show();
});
shouldFocusWindow = false; shouldFocusWindow = false;
} }
break; break;
@@ -56,7 +56,7 @@
icon="el-icon-check" icon="el-icon-check"
circle circle
style="margin-left: 5px" style="margin-left: 5px"
@click.stop="selectAvatarWithConfirmation"></el-button> @click.stop="selectAvatarWithConfirmation(favorite.id)"></el-button>
</el-tooltip> </el-tooltip>
<el-tooltip <el-tooltip
placement="right" placement="right"
@@ -90,7 +90,7 @@
circle circle
style="margin-left: 5px" style="margin-left: 5px"
icon="el-icon-check" icon="el-icon-check"
@click.stop="selectAvatarWithConfirmation" /> @click.stop="selectAvatarWithConfirmation(favorite.id)" />
</el-tooltip> </el-tooltip>
</template> </template>
<el-tooltip <el-tooltip