mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
fix: Deleted friends/unfriends on the Friend Log will reappear when you close and open the app again (#1262)
This commit is contained in:
@@ -116,13 +116,27 @@ const friendLogHistory = {
|
|||||||
return friendLogHistory;
|
return friendLogHistory;
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteFriendLogHistory(rowId) {
|
// https://github.com/vrcx-team/VRCX/issues/1262
|
||||||
sqliteService.executeNonQuery(
|
deleteFriendLogHistory(entry) {
|
||||||
`DELETE FROM ${dbVars.userPrefix}_friend_log_history WHERE id = @row_id`,
|
if (entry.rowId != null) {
|
||||||
{
|
sqliteService.executeNonQuery(
|
||||||
'@row_id': rowId
|
`DELETE FROM ${dbVars.userPrefix}_friend_log_history WHERE id = @row_id`,
|
||||||
}
|
{
|
||||||
);
|
'@row_id': entry.rowId
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Entries created in-session don't have a rowId yet;
|
||||||
|
// fall back to composite key so the DB row is still removed.
|
||||||
|
sqliteService.executeNonQuery(
|
||||||
|
`DELETE FROM ${dbVars.userPrefix}_friend_log_history WHERE created_at = @created_at AND type = @type AND user_id = @user_id`,
|
||||||
|
{
|
||||||
|
'@created_at': entry.created_at,
|
||||||
|
'@type': entry.type,
|
||||||
|
'@user_id': entry.userId
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@
|
|||||||
*/
|
*/
|
||||||
function deleteFriendLog(row) {
|
function deleteFriendLog(row) {
|
||||||
removeFromArray(friendLogTable.value.data, row);
|
removeFromArray(friendLogTable.value.data, row);
|
||||||
database.deleteFriendLogHistory(row.rowId);
|
database.deleteFriendLogHistory(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns = createColumns({
|
const columns = createColumns({
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ describe('FriendLog.vue', () => {
|
|||||||
mocks.friendLogTable.value.data,
|
mocks.friendLogTable.value.data,
|
||||||
row
|
row
|
||||||
);
|
);
|
||||||
expect(mocks.deleteFriendLogHistory).toHaveBeenCalledWith(55);
|
expect(mocks.deleteFriendLogHistory).toHaveBeenCalledWith(row);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('resets page index when page size changes', async () => {
|
test('resets page index when page size changes', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user