mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 03:51:12 -05:00
Fix: Remove all traces of username sorting
This commit is contained in:
@@ -22,7 +22,6 @@ const getEntityFilterIcon = (filter: EntityFilter) => {
|
|||||||
|
|
||||||
const getSortFieldLabel = (field: SortField): string => {
|
const getSortFieldLabel = (field: SortField): string => {
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case 'username': return 'Submitter';
|
|
||||||
case 'submission_type': return 'Type';
|
case 'submission_type': return 'Type';
|
||||||
case 'escalated': return 'Escalated';
|
case 'escalated': return 'Escalated';
|
||||||
case 'status': return 'Status';
|
case 'status': return 'Status';
|
||||||
|
|||||||
@@ -27,12 +27,6 @@ export function sortModerationItems(
|
|||||||
comparison = new Date(a.created_at).getTime() - new Date(b.created_at).getTime();
|
comparison = new Date(a.created_at).getTime() - new Date(b.created_at).getTime();
|
||||||
break;
|
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':
|
case 'submission_type':
|
||||||
comparison = (a.submission_type || '').localeCompare(b.submission_type || '');
|
comparison = (a.submission_type || '').localeCompare(b.submission_type || '');
|
||||||
break;
|
break;
|
||||||
@@ -77,7 +71,16 @@ export function loadSortConfig(key: string = 'moderationQueue_sortConfig'): Sort
|
|||||||
try {
|
try {
|
||||||
const saved = localStorage.getItem(key);
|
const saved = localStorage.getItem(key);
|
||||||
if (saved) {
|
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) {
|
} catch (error) {
|
||||||
console.error('Failed to load sort config:', error);
|
console.error('Failed to load sort config:', error);
|
||||||
@@ -123,8 +126,6 @@ export function getSortFieldLabel(field: SortField): string {
|
|||||||
switch (field) {
|
switch (field) {
|
||||||
case 'created_at':
|
case 'created_at':
|
||||||
return 'Date Created';
|
return 'Date Created';
|
||||||
case 'username':
|
|
||||||
return 'Submitter';
|
|
||||||
case 'submission_type':
|
case 'submission_type':
|
||||||
return 'Type';
|
return 'Type';
|
||||||
case 'status':
|
case 'status':
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export type QueueTab = 'mainQueue' | 'archive';
|
|||||||
/**
|
/**
|
||||||
* Fields that can be used for sorting the moderation queue
|
* Fields that can be used for sorting the moderation queue
|
||||||
*/
|
*/
|
||||||
export type SortField = 'created_at' | 'username' | 'submission_type' | 'status' | 'escalated';
|
export type SortField = 'created_at' | 'submission_type' | 'status' | 'escalated';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Direction for sorting (ascending or descending)
|
* Direction for sorting (ascending or descending)
|
||||||
|
|||||||
Reference in New Issue
Block a user