mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-14 12:23:52 +02:00
Fetch userId from DB & small fixes
This commit is contained in:
@@ -6756,7 +6756,9 @@ speechSynthesis.getVoices();
|
||||
) {
|
||||
ctx.ref = ref;
|
||||
ctx.isVIP = isVIP;
|
||||
ctx.name = ref.displayName;
|
||||
if (typeof ref !== 'undefined') {
|
||||
ctx.name = ref.displayName;
|
||||
}
|
||||
// delayed second check to prevent status flapping
|
||||
var date = this.updateFriendInProgress.get(id);
|
||||
if (date && date > Date.now() - 120000) {
|
||||
@@ -6789,7 +6791,9 @@ speechSynthesis.getVoices();
|
||||
} else {
|
||||
ctx.ref = ref;
|
||||
ctx.isVIP = isVIP;
|
||||
ctx.name = ref.displayName;
|
||||
if (typeof ref !== 'undefined') {
|
||||
ctx.name = ref.displayName;
|
||||
}
|
||||
this.updateFriendDelayedCheck(
|
||||
id,
|
||||
ctx,
|
||||
@@ -6877,8 +6881,8 @@ speechSynthesis.getVoices();
|
||||
var feed = {
|
||||
created_at: new Date().toJSON(),
|
||||
type: 'Online',
|
||||
userId: ctx.ref.id,
|
||||
displayName: ctx.ref.displayName,
|
||||
userId: id,
|
||||
displayName: ctx.name,
|
||||
location: newRef.location,
|
||||
worldName,
|
||||
time: ''
|
||||
@@ -8273,6 +8277,15 @@ speechSynthesis.getVoices();
|
||||
// set $location_at to join time if user isn't a friend
|
||||
ref.$location_at = joinTime;
|
||||
}
|
||||
} else {
|
||||
// try fetch userId from previous encounter using database
|
||||
database
|
||||
.getUserIdFromDisplayName(gameLog.userDisplayName)
|
||||
.then((oldUserId) => {
|
||||
if (oldUserId && this.isGameRunning) {
|
||||
API.getUser({userId: oldUserId});
|
||||
}
|
||||
});
|
||||
}
|
||||
this.updateVRLastLocation();
|
||||
this.getCurrentInstanceUserList();
|
||||
|
||||
@@ -949,7 +949,7 @@ html
|
||||
template(v-once #default="scope")
|
||||
span {{ scope.row.last_login | formatDate('long') }}
|
||||
el-table-column(label="Date Joined" width="120" prop="date_joined" sortable :sort-method="(a, b) => sortAlphabetically(a, b, 'date_joined')")
|
||||
el-table-column(label="Unfriend" width="80" align="right")
|
||||
el-table-column(label="Unfriend" width="80")
|
||||
template(v-once #default="scope")
|
||||
el-button(type="text" icon="el-icon-close" size="mini" @click.stop="confirmDeleteFriend(scope.row.id)")
|
||||
|
||||
@@ -2251,10 +2251,7 @@ html
|
||||
timer(:epoch="scope.row.date")
|
||||
el-table-column(label="Name" prop="name")
|
||||
template(v-once #default="scope")
|
||||
template(v-if="scope.row.ref.id === 'VRCXUpdate'")
|
||||
el-button(size="small" @click="showVRCXUpdateDialog") VRCX Update
|
||||
template(v-else)
|
||||
span(v-text="scope.row.ref.name")
|
||||
span(v-text="scope.row.ref.name")
|
||||
el-table-column(label="Type" prop="type" width="70")
|
||||
el-table-column(label="Status" prop="status" width="80")
|
||||
template(#footer)
|
||||
@@ -2283,17 +2280,17 @@ html
|
||||
el-form(:model="launchDialog" label-width="80px")
|
||||
el-form-item(label="URL")
|
||||
el-input(v-model="launchDialog.url" size="mini" @click.native="$event.target.tagName === 'INPUT' && $event.target.select()" style="width:260px")
|
||||
el-tooltip(placement="top" content="Copy to clipboard" :disabled="hideTooltips")
|
||||
el-tooltip(placement="right" content="Copy to clipboard" :disabled="hideTooltips")
|
||||
el-button(@click="copyInstanceMessage(launchDialog.url)" size="mini" icon="el-icon-s-order" style="margin-right:5px" circle)
|
||||
el-form-item(v-if="launchDialog.shortUrl" label="Short URL")
|
||||
el-tooltip(placement="top" style="margin-left:5px" content="Short URL's expire after a set period of time")
|
||||
i.el-icon-warning
|
||||
el-input(v-model="launchDialog.shortUrl" size="mini" @click.native="$event.target.tagName === 'INPUT' && $event.target.select()" style="width:241px")
|
||||
el-tooltip(placement="top" content="Copy to clipboard" :disabled="hideTooltips")
|
||||
el-tooltip(placement="right" content="Copy to clipboard" :disabled="hideTooltips")
|
||||
el-button(@click="copyInstanceMessage(launchDialog.shortUrl)" size="mini" icon="el-icon-s-order" style="margin-right:5px" circle)
|
||||
el-form-item(label="Location")
|
||||
el-input(v-model="launchDialog.location" size="mini" @click.native="$event.target.tagName === 'INPUT' && $event.target.select()" style="width:260px")
|
||||
el-tooltip(placement="top" content="Copy to clipboard" :disabled="hideTooltips")
|
||||
el-tooltip(placement="right" content="Copy to clipboard" :disabled="hideTooltips")
|
||||
el-button(@click="copyInstanceMessage(launchDialog.location)" size="mini" icon="el-icon-s-order" style="margin-right:5px" circle)
|
||||
template(#footer)
|
||||
el-checkbox(v-model="launchDialog.desktop" style="float:left;margin-top:5px") Start as Desktop (No VR)
|
||||
@@ -2303,17 +2300,17 @@ html
|
||||
|
||||
//- dialog: export friends list
|
||||
el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" :visible.sync="exportFriendsListDialog" title="Export Friends List" width="650px")
|
||||
el-input(type="textarea" v-model="exportFriendsListContent" size="mini" rows="15" resize="none" readonly style="margin-top:15px" @click.native="$event.target.tagName === 'TEXTAREA' && $event.target.select()")
|
||||
el-input(type="textarea" v-if="exportFriendsListDialog" v-model="exportFriendsListContent" size="mini" rows="15" resize="none" readonly style="margin-top:15px" @click.native="$event.target.tagName === 'TEXTAREA' && $event.target.select()")
|
||||
|
||||
//- dialog: export avatars list
|
||||
el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" :visible.sync="exportAvatarsListDialog" title="Export Own Avatars" width="650px")
|
||||
el-input(type="textarea" v-model="exportAvatarsListContent" size="mini" rows="15" resize="none" readonly style="margin-top:15px" @click.native="$event.target.tagName === 'TEXTAREA' && $event.target.select()")
|
||||
el-input(type="textarea" v-if="exportAvatarsListDialog" v-model="exportAvatarsListContent" size="mini" rows="15" resize="none" readonly style="margin-top:15px" @click.native="$event.target.tagName === 'TEXTAREA' && $event.target.select()")
|
||||
|
||||
//- dialog: Discord username list
|
||||
el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" :visible.sync="discordNamesDialogVisible" title="Discord Names" width="650px")
|
||||
div(style='font-size:12px;')
|
||||
| Click load missing entries in the Friends List tab to search entire friends list
|
||||
el-input(type="textarea" v-model="discordNamesContent" size="mini" rows="15" resize="none" readonly style="margin-top:15px")
|
||||
el-input(type="textarea" v-if="discordNamesDialogVisible" v-model="discordNamesContent" size="mini" rows="15" resize="none" readonly style="margin-top:15px")
|
||||
|
||||
//- dialog: Notification position
|
||||
el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="notificationPositionDialog" :visible.sync="notificationPositionDialog.visible" title="Notification Position" width="400px")
|
||||
|
||||
@@ -1626,6 +1626,20 @@ class Database {
|
||||
`UPDATE gamelog_join_leave SET time = 0 WHERE id IN (${badEntriesList})`
|
||||
);
|
||||
}
|
||||
|
||||
async getUserIdFromDisplayName(displayName) {
|
||||
var userId = '';
|
||||
await sqliteService.execute(
|
||||
(row) => {
|
||||
userId = row[0];
|
||||
},
|
||||
`SELECT user_id FROM gamelog_join_leave WHERE display_name = @displayName AND user_id != "" ORDER BY id DESC LIMIT 1`,
|
||||
{
|
||||
'@displayName': displayName
|
||||
}
|
||||
);
|
||||
return userId;
|
||||
}
|
||||
}
|
||||
|
||||
var self = new Database();
|
||||
|
||||
Reference in New Issue
Block a user