mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 14:46:04 +02:00
remove unnecessary getUser
This commit is contained in:
+136
-154
@@ -874,177 +874,159 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
})
|
})
|
||||||
.then((args) => {
|
.then((args) => {
|
||||||
if (args.ref.id === D.id) {
|
if (args.ref.id === D.id) {
|
||||||
requestAnimationFrame(() => {
|
D.loading = false;
|
||||||
D.ref = args.ref;
|
|
||||||
uiStore.setDialogCrumbLabel(
|
D.ref = args.ref;
|
||||||
'user',
|
uiStore.setDialogCrumbLabel(
|
||||||
D.id,
|
'user',
|
||||||
D.ref?.displayName || D.id
|
D.id,
|
||||||
);
|
D.ref?.displayName || D.id
|
||||||
D.friend = friendStore.friends.get(D.id);
|
);
|
||||||
D.isFriend = Boolean(D.friend);
|
D.friend = friendStore.friends.get(D.id);
|
||||||
D.note = String(D.ref.note || '');
|
D.isFriend = Boolean(D.friend);
|
||||||
D.incomingRequest = false;
|
D.note = String(D.ref.note || '');
|
||||||
D.outgoingRequest = false;
|
D.incomingRequest = false;
|
||||||
D.isBlock = false;
|
D.outgoingRequest = false;
|
||||||
D.isMute = false;
|
D.isBlock = false;
|
||||||
D.isInteractOff = false;
|
D.isMute = false;
|
||||||
D.isMuteChat = false;
|
D.isInteractOff = false;
|
||||||
for (const ref of moderationStore.cachedPlayerModerations.values()) {
|
D.isMuteChat = false;
|
||||||
if (
|
for (const ref of moderationStore.cachedPlayerModerations.values()) {
|
||||||
ref.targetUserId === D.id &&
|
|
||||||
ref.sourceUserId === currentUser.value.id
|
|
||||||
) {
|
|
||||||
if (ref.type === 'block') {
|
|
||||||
D.isBlock = true;
|
|
||||||
} else if (ref.type === 'mute') {
|
|
||||||
D.isMute = true;
|
|
||||||
} else if (ref.type === 'interactOff') {
|
|
||||||
D.isInteractOff = true;
|
|
||||||
} else if (ref.type === 'muteChat') {
|
|
||||||
D.isMuteChat = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
D.isFavorite =
|
|
||||||
favoriteStore.getCachedFavoritesByObjectId(D.id);
|
|
||||||
if (D.ref.friendRequestStatus === 'incoming') {
|
|
||||||
D.incomingRequest = true;
|
|
||||||
} else if (D.ref.friendRequestStatus === 'outgoing') {
|
|
||||||
D.outgoingRequest = true;
|
|
||||||
}
|
|
||||||
userRequest.getUser(args.params).then((args1) => {
|
|
||||||
if (args1.ref.id === D.id) {
|
|
||||||
D.loading = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let inCurrentWorld = false;
|
|
||||||
if (
|
if (
|
||||||
locationStore.lastLocation.playerList.has(D.ref.id)
|
ref.targetUserId === D.id &&
|
||||||
|
ref.sourceUserId === currentUser.value.id
|
||||||
) {
|
) {
|
||||||
inCurrentWorld = true;
|
if (ref.type === 'block') {
|
||||||
|
D.isBlock = true;
|
||||||
|
} else if (ref.type === 'mute') {
|
||||||
|
D.isMute = true;
|
||||||
|
} else if (ref.type === 'interactOff') {
|
||||||
|
D.isInteractOff = true;
|
||||||
|
} else if (ref.type === 'muteChat') {
|
||||||
|
D.isMuteChat = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (userId !== currentUser.value.id) {
|
}
|
||||||
database
|
D.isFavorite = favoriteStore.getCachedFavoritesByObjectId(
|
||||||
.getUserStats(D.ref, inCurrentWorld)
|
D.id
|
||||||
.then(async (ref1) => {
|
);
|
||||||
if (ref1.userId === D.id) {
|
if (D.ref.friendRequestStatus === 'incoming') {
|
||||||
D.lastSeen = ref1.lastSeen;
|
D.incomingRequest = true;
|
||||||
D.joinCount = ref1.joinCount;
|
} else if (D.ref.friendRequestStatus === 'outgoing') {
|
||||||
D.timeSpent = ref1.timeSpent;
|
D.outgoingRequest = true;
|
||||||
|
}
|
||||||
|
let inCurrentWorld = false;
|
||||||
|
if (locationStore.lastLocation.playerList.has(D.ref.id)) {
|
||||||
|
inCurrentWorld = true;
|
||||||
|
}
|
||||||
|
if (userId !== currentUser.value.id) {
|
||||||
|
database
|
||||||
|
.getUserStats(D.ref, inCurrentWorld)
|
||||||
|
.then(async (ref1) => {
|
||||||
|
if (ref1.userId === D.id) {
|
||||||
|
D.lastSeen = ref1.lastSeen;
|
||||||
|
D.joinCount = ref1.joinCount;
|
||||||
|
D.timeSpent = ref1.timeSpent;
|
||||||
|
}
|
||||||
|
const displayNameMap =
|
||||||
|
ref1.previousDisplayNames;
|
||||||
|
const userNotifications =
|
||||||
|
await database.getFriendLogHistoryForUserId(
|
||||||
|
D.id,
|
||||||
|
['DisplayName', 'Friend', 'Unfriend']
|
||||||
|
);
|
||||||
|
const dateFriendedInfo = [];
|
||||||
|
for (const notification of userNotifications) {
|
||||||
|
if (notification.userId !== D.id) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
const displayNameMap =
|
if (notification.type === 'DisplayName') {
|
||||||
ref1.previousDisplayNames;
|
displayNameMap.set(
|
||||||
const userNotifications =
|
notification.previousDisplayName,
|
||||||
await database.getFriendLogHistoryForUserId(
|
notification.created_at
|
||||||
D.id,
|
|
||||||
[
|
|
||||||
'DisplayName',
|
|
||||||
'Friend',
|
|
||||||
'Unfriend'
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
const dateFriendedInfo = [];
|
}
|
||||||
for (const notification of userNotifications) {
|
if (!D.dateFriended) {
|
||||||
if (notification.userId !== D.id) {
|
if (notification.type === 'Unfriend') {
|
||||||
continue;
|
D.unFriended = true;
|
||||||
}
|
|
||||||
if (
|
|
||||||
notification.type === 'DisplayName'
|
|
||||||
) {
|
|
||||||
displayNameMap.set(
|
|
||||||
notification.previousDisplayName,
|
|
||||||
notification.created_at
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!D.dateFriended) {
|
|
||||||
if (
|
if (
|
||||||
notification.type === 'Unfriend'
|
!appearanceSettingsStore.hideUnfriends
|
||||||
) {
|
) {
|
||||||
D.unFriended = true;
|
|
||||||
if (
|
|
||||||
!appearanceSettingsStore.hideUnfriends
|
|
||||||
) {
|
|
||||||
D.dateFriended =
|
|
||||||
notification.created_at;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
notification.type === 'Friend'
|
|
||||||
) {
|
|
||||||
D.unFriended = false;
|
|
||||||
D.dateFriended =
|
D.dateFriended =
|
||||||
notification.created_at;
|
notification.created_at;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (notification.type === 'Friend') {
|
||||||
notification.type === 'Friend' ||
|
D.unFriended = false;
|
||||||
(notification.type === 'Unfriend' &&
|
D.dateFriended =
|
||||||
!appearanceSettingsStore.hideUnfriends)
|
notification.created_at;
|
||||||
) {
|
|
||||||
dateFriendedInfo.unshift(
|
|
||||||
notification
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
D.dateFriendedInfo = dateFriendedInfo;
|
if (
|
||||||
displayNameMap.forEach(
|
notification.type === 'Friend' ||
|
||||||
(updated_at, displayName) => {
|
(notification.type === 'Unfriend' &&
|
||||||
D.previousDisplayNames.push({
|
!appearanceSettingsStore.hideUnfriends)
|
||||||
displayName,
|
) {
|
||||||
updated_at
|
dateFriendedInfo.unshift(notification);
|
||||||
});
|
}
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
AppApi.GetVRChatUserModeration(
|
|
||||||
currentUser.value.id,
|
|
||||||
userId
|
|
||||||
).then((result) => {
|
|
||||||
D.avatarModeration = result;
|
|
||||||
if (result === 4) {
|
|
||||||
D.isHideAvatar = true;
|
|
||||||
} else if (result === 5) {
|
|
||||||
D.isShowAvatar = true;
|
|
||||||
}
|
}
|
||||||
});
|
D.dateFriendedInfo = dateFriendedInfo;
|
||||||
if (!currentUser.value.hasSharedConnectionsOptOut) {
|
displayNameMap.forEach(
|
||||||
try {
|
(updated_at, displayName) => {
|
||||||
userRequest
|
D.previousDisplayNames.push({
|
||||||
.getMutualCounts({ userId })
|
displayName,
|
||||||
.then((args) => {
|
updated_at
|
||||||
if (args.params.userId === D.id) {
|
|
||||||
D.mutualFriendCount =
|
|
||||||
args.json.friends;
|
|
||||||
D.mutualGroupCount =
|
|
||||||
args.json.groups;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
D.previousDisplayNames =
|
|
||||||
currentUser.value.pastDisplayNames;
|
|
||||||
database
|
|
||||||
.getUserStats(D.ref, inCurrentWorld)
|
|
||||||
.then((ref1) => {
|
|
||||||
if (ref1.userId === D.id) {
|
|
||||||
D.lastSeen = ref1.lastSeen;
|
|
||||||
D.joinCount = ref1.joinCount;
|
|
||||||
D.timeSpent = ref1.timeSpent;
|
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
}
|
|
||||||
groupRequest
|
|
||||||
.getRepresentedGroup({ userId })
|
|
||||||
.then((args1) => {
|
|
||||||
groupStore.handleGroupRepresented(args1);
|
|
||||||
});
|
});
|
||||||
D.visible = true;
|
AppApi.GetVRChatUserModeration(
|
||||||
applyUserDialogLocation(true);
|
currentUser.value.id,
|
||||||
});
|
userId
|
||||||
|
).then((result) => {
|
||||||
|
D.avatarModeration = result;
|
||||||
|
if (result === 4) {
|
||||||
|
D.isHideAvatar = true;
|
||||||
|
} else if (result === 5) {
|
||||||
|
D.isShowAvatar = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!currentUser.value.hasSharedConnectionsOptOut) {
|
||||||
|
try {
|
||||||
|
userRequest
|
||||||
|
.getMutualCounts({ userId })
|
||||||
|
.then((args) => {
|
||||||
|
if (args.params.userId === D.id) {
|
||||||
|
D.mutualFriendCount =
|
||||||
|
args.json.friends;
|
||||||
|
D.mutualGroupCount =
|
||||||
|
args.json.groups;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
D.previousDisplayNames =
|
||||||
|
currentUser.value.pastDisplayNames;
|
||||||
|
database
|
||||||
|
.getUserStats(D.ref, inCurrentWorld)
|
||||||
|
.then((ref1) => {
|
||||||
|
if (ref1.userId === D.id) {
|
||||||
|
D.lastSeen = ref1.lastSeen;
|
||||||
|
D.joinCount = ref1.joinCount;
|
||||||
|
D.timeSpent = ref1.timeSpent;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
groupRequest
|
||||||
|
.getRepresentedGroup({ userId })
|
||||||
|
.then((args1) => {
|
||||||
|
groupStore.handleGroupRepresented(args1);
|
||||||
|
});
|
||||||
|
D.visible = true;
|
||||||
|
applyUserDialogLocation(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
showUserDialogHistory.delete(userId);
|
showUserDialogHistory.delete(userId);
|
||||||
|
|||||||
Reference in New Issue
Block a user