Reverted to commit de2d4a495f

This commit is contained in:
gpt-engineer-app[bot]
2025-10-13 13:05:48 +00:00
parent c129be2e87
commit 4fed307335
6 changed files with 144 additions and 160 deletions

View File

@@ -57,7 +57,7 @@ export function sortModerationItems(
export function getDefaultSortConfig(): SortConfig {
return {
field: 'created_at',
direction: 'desc', // Newest first by default
direction: 'asc',
};
}
@@ -71,7 +71,16 @@ export function loadSortConfig(key: string = 'moderationQueue_sortConfig'): Sort
try {
const saved = localStorage.getItem(key);
if (saved) {
return JSON.parse(saved);
const config = JSON.parse(saved);
// Migrate old 'username' sort to 'created_at'
if (config.field === 'username') {
console.warn('[Sort] Migrating deprecated username sort to created_at');
config.field = 'created_at';
saveSortConfig(config, key); // Save the migrated config
}
return config;
}
} catch (error) {
console.error('Failed to load sort config:', error);