mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Fix null notifications
This commit is contained in:
@@ -22600,7 +22600,7 @@ speechSynthesis.getVoices();
|
|||||||
$app.data.databaseVersion = configRepository.getInt('VRCX_databaseVersion');
|
$app.data.databaseVersion = configRepository.getInt('VRCX_databaseVersion');
|
||||||
|
|
||||||
$app.methods.updateDatabaseVersion = async function () {
|
$app.methods.updateDatabaseVersion = async function () {
|
||||||
var databaseVersion = 4;
|
var databaseVersion = 5;
|
||||||
if (this.databaseVersion !== databaseVersion) {
|
if (this.databaseVersion !== databaseVersion) {
|
||||||
var msgBox = this.$message({
|
var msgBox = this.$message({
|
||||||
message: 'DO NOT CLOSE VRCX, database upgrade in process...',
|
message: 'DO NOT CLOSE VRCX, database upgrade in process...',
|
||||||
@@ -22617,6 +22617,7 @@ speechSynthesis.getVoices();
|
|||||||
await database.fixBrokenLeaveEntries(); // fix user instance timer being higher than current user location timer
|
await database.fixBrokenLeaveEntries(); // fix user instance timer being higher than current user location timer
|
||||||
await database.fixBrokenGroupInvites(); // fix notification v2 in wrong table
|
await database.fixBrokenGroupInvites(); // fix notification v2 in wrong table
|
||||||
await database.updateTableForGroupNames(); // alter tables to include group name
|
await database.updateTableForGroupNames(); // alter tables to include group name
|
||||||
|
database.fixBrokenNotifications(); // fix notifications being null
|
||||||
this.databaseVersion = databaseVersion;
|
this.databaseVersion = databaseVersion;
|
||||||
configRepository.setInt(
|
configRepository.setInt(
|
||||||
'VRCX_databaseVersion',
|
'VRCX_databaseVersion',
|
||||||
|
|||||||
@@ -709,6 +709,10 @@ class Database {
|
|||||||
if (row.$isExpired) {
|
if (row.$isExpired) {
|
||||||
expired = 1;
|
expired = 1;
|
||||||
}
|
}
|
||||||
|
if (!entry.created_at || !entry.type || !entry.id) {
|
||||||
|
console.error('Notification is missing required field', entry);
|
||||||
|
throw new Error('Notification is missing required field');
|
||||||
|
}
|
||||||
sqliteService.executeNonQuery(
|
sqliteService.executeNonQuery(
|
||||||
`INSERT OR IGNORE INTO ${Database.userPrefix}_notifications (id, created_at, type, sender_user_id, sender_username, receiver_user_id, message, world_id, world_name, image_url, invite_message, request_message, response_message, expired) VALUES (@id, @created_at, @type, @sender_user_id, @sender_username, @receiver_user_id, @message, @world_id, @world_name, @image_url, @invite_message, @request_message, @response_message, @expired)`,
|
`INSERT OR IGNORE INTO ${Database.userPrefix}_notifications (id, created_at, type, sender_user_id, sender_username, receiver_user_id, message, world_id, world_name, image_url, invite_message, request_message, response_message, expired) VALUES (@id, @created_at, @type, @sender_user_id, @sender_username, @receiver_user_id, @message, @world_id, @world_name, @image_url, @invite_message, @request_message, @response_message, @expired)`,
|
||||||
{
|
{
|
||||||
@@ -1951,6 +1955,12 @@ class Database {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fixBrokenNotifications() {
|
||||||
|
sqliteService.executeNonQuery(
|
||||||
|
`DELETE FROM ${Database.userPrefix}_notifications WHERE (created_at is null or created_at = '')`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async updateTableForGroupNames() {
|
async updateTableForGroupNames() {
|
||||||
var tables = [];
|
var tables = [];
|
||||||
await sqliteService.execute((dbRow) => {
|
await sqliteService.execute((dbRow) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user