Small changes

Add "friends in instance" to invite dialog
Change XS notification height depending on text length
Attempt to fetch userId's for users in current instance
Add user dialog friend history tooltip
This commit is contained in:
Natsumi
2023-10-27 23:34:48 +13:00
parent e93b83fd10
commit 6ba1856a7a
5 changed files with 205 additions and 90 deletions

View File

@@ -9599,6 +9599,7 @@ speechSynthesis.getVoices();
};
database.updateGamelogLocationTimeToDatabase(update);
}
this.gameLogApiLoggingEnabled = false;
this.lastLocationDestination = '';
this.lastLocationDestinationTime = 0;
this.lastLocation = {
@@ -9871,6 +9872,7 @@ speechSynthesis.getVoices();
$app.data.lastLocationDestinationTime = 0;
$app.data.lastVideoUrl = '';
$app.data.lastResourceloadUrl = '';
$app.data.gameLogApiLoggingEnabled = false;
$app.methods.addGameLogEntry = function (gameLog, location) {
if (this.gameLogDisabled) {
@@ -9976,8 +9978,18 @@ speechSynthesis.getVoices();
database
.getUserIdFromDisplayName(gameLog.displayName)
.then((oldUserId) => {
if (oldUserId && this.isGameRunning) {
API.getUser({ userId: oldUserId });
if (this.isGameRunning) {
if (oldUserId) {
API.getUser({ userId: oldUserId });
} else if (Date.now() - joinTime < 5 * 1000) {
workerTimers.setTimeout(
() =>
this.silentSeachUser(
gameLog.displayName
),
10 * 1000
);
}
}
});
}
@@ -10130,8 +10142,11 @@ speechSynthesis.getVoices();
} catch (err) {
console.error(err);
}
if (userId && !API.cachedUsers.has(userId)) {
API.getUser({ userId });
if (userId) {
this.gameLogApiLoggingEnabled = true;
if (!API.cachedUsers.has(userId)) {
API.getUser({ userId });
}
}
break;
case 'vrcx':
@@ -10244,6 +10259,39 @@ speechSynthesis.getVoices();
}
};
$app.methods.silentSeachUser = function (displayName) {
var playerListRef = this.lastLocation.playerList.get(displayName);
if (!this.gameLogApiLoggingEnabled || playerListRef.userId) {
return;
}
if (this.debugGameLog) {
console.log('Fetching userId for', displayName);
}
var params = {
n: 5,
offset: 0,
fuzzy: false,
search: displayName
};
API.getUsers(params).then((args) => {
var map = new Map();
var nameFound = false;
for (var json of args.json) {
var ref = API.cachedUsers.get(json.id);
if (typeof ref !== 'undefined') {
map.set(ref.id, ref);
}
if (json.displayName === displayName) {
nameFound = true;
}
}
if (!nameFound) {
console.error('userId not found for', displayName);
}
return args;
});
};
$app.methods.addGamelogLocationToDatabase = async function (input) {
var groupName = await this.getGroupName(input.location);
var entry = {
@@ -12742,7 +12790,7 @@ speechSynthesis.getVoices();
n: 10,
offset: 0,
fuzzy: false,
search: this.replaceBioSymbols(displayName)
search: displayName
};
await this.moreSearchUser();
};
@@ -12751,7 +12799,7 @@ speechSynthesis.getVoices();
this.searchUserParams = {
n: 10,
offset: 0,
search: this.replaceBioSymbols(this.searchText)
search: this.searchText
};
await this.moreSearchUser();
};
@@ -15927,7 +15975,8 @@ speechSynthesis.getVoices();
avatarModeration: 0,
previousDisplayNames: [],
dateFriended: '',
unFriended: false
unFriended: false,
dateFriendedInfo: []
};
$app.data.ignoreUserMemoSave = false;
@@ -16208,6 +16257,7 @@ speechSynthesis.getVoices();
D.previousDisplayNames = [];
D.dateFriended = '';
D.unFriended = false;
D.dateFriendedInfo = [];
if (userId === API.currentUser.id) {
this.getWorldName(API.currentUser.homeLocation).then(
(worldName) => {
@@ -16349,6 +16399,12 @@ speechSynthesis.getVoices();
ref2.created_at;
}
}
if (
ref2.type === 'Friend' ||
ref2.type === 'Unfriend'
) {
D.dateFriendedInfo.push(ref2);
}
}
});
var displayNameMapSorted = new Map(
@@ -18621,7 +18677,8 @@ speechSynthesis.getVoices();
loading: false,
worldId: '',
worldName: '',
userIds: []
userIds: [],
friendsInInstance: []
};
API.$on('LOGOUT', function () {
@@ -18697,6 +18754,15 @@ speechSynthesis.getVoices();
D.userIds = [];
D.worldId = L.tag;
D.worldName = args.ref.name;
D.friendsInInstance = [];
for (var ctx of this.friends.values()) {
if (typeof ctx.ref === 'undefined') {
continue;
}
if (ctx.ref.location === this.lastLocation.location) {
D.friendsInInstance.push(ctx);
}
}
D.visible = true;
});
};

View File

@@ -431,9 +431,16 @@ html
span.name {{ $t('dialog.user.info.date_joined') }}
span.extra(v-text="userDialog.ref.date_joined")
.x-friend-item(v-if="API.currentUser.id !== userDialog.id" style="cursor:default")
.detail
span.name(v-if="userDialog.unFriended") {{ $t('dialog.user.info.unfriended') }}
el-tooltip(v-if="!hideTooltips" placement="top" style="margin-left:5px" :content="$t('dialog.user.info.accuracy_notice')")
el-tooltip(placement="top")
template(#content v-if="userDialog.dateFriendedInfo.length")
template(v-for="ref in userDialog.dateFriendedInfo")
span {{ ref.type }}: {{ ref.created_at | formatDate('long') }}
br
template(#content v-else)
span -
.detail
span.name(v-if="userDialog.unFriended") {{ $t('dialog.user.info.unfriended') }}
el-tooltip(v-if="!hideTooltips" placement="top" style="margin-left:5px" :content="$t('dialog.user.info.accuracy_notice')")
i.el-icon-warning
span.name(v-else) {{ $t('dialog.user.info.friended') }}
el-tooltip(v-if="!hideTooltips" placement="top" style="margin-left:5px" :content="$t('dialog.user.info.accuracy_notice')")
@@ -1216,6 +1223,14 @@ html
img(v-lazy="userImage(API.currentUser)")
.detail
span.name(v-text="API.currentUser.displayName")
el-option-group(v-if="inviteDialog.friendsInInstance.length" :label="$t('dialog.invite.friends_in_instance')")
el-option.x-friend-item(v-for="friend in inviteDialog.friendsInInstance" :key="friend.id" :label="friend.name" :value="friend.id" style="height:auto")
template(v-if="friend.ref")
.avatar(:class="userStatusClass(friend.ref)")
img(v-lazy="userImage(friend.ref)")
.detail
span.name(v-text="friend.ref.displayName" :style="{'color':friend.ref.$userColour}")
span(v-else v-text="friend.id")
el-option-group(v-if="friendsGroup0.length" :label="$t('side_panel.favorite')")
el-option.x-friend-item(v-for="friend in friendsGroup0" :key="friend.id" :label="friend.name" :value="friend.id" style="height:auto")
template(v-if="friend.ref")

View File

@@ -868,7 +868,8 @@
"header": "Invite",
"select_placeholder": "Choose Friends",
"invite_with_message": "Invite With Message",
"invite": "Invite"
"invite": "Invite",
"friends_in_instance": "Friends In Instance"
},
"social_status": {
"header": "Social Status",