mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 03:31:13 -05:00
Reverted to commit be92deec43
This commit is contained in:
@@ -27,6 +27,12 @@ export function sortModerationItems(
|
||||
comparison = new Date(a.created_at).getTime() - new Date(b.created_at).getTime();
|
||||
break;
|
||||
|
||||
case 'username':
|
||||
const usernameA = a.user_profile?.username || a.user_profile?.display_name || '';
|
||||
const usernameB = b.user_profile?.username || b.user_profile?.display_name || '';
|
||||
comparison = usernameA.localeCompare(usernameB);
|
||||
break;
|
||||
|
||||
case 'submission_type':
|
||||
comparison = (a.submission_type || '').localeCompare(b.submission_type || '');
|
||||
break;
|
||||
@@ -71,16 +77,7 @@ export function loadSortConfig(key: string = 'moderationQueue_sortConfig'): Sort
|
||||
try {
|
||||
const saved = localStorage.getItem(key);
|
||||
if (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;
|
||||
return JSON.parse(saved);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load sort config:', error);
|
||||
@@ -126,6 +123,8 @@ export function getSortFieldLabel(field: SortField): string {
|
||||
switch (field) {
|
||||
case 'created_at':
|
||||
return 'Date Created';
|
||||
case 'username':
|
||||
return 'Submitter';
|
||||
case 'submission_type':
|
||||
return 'Type';
|
||||
case 'status':
|
||||
|
||||
Reference in New Issue
Block a user