diff --git a/src/views/mod-queue/mod-queue.tsx b/src/views/mod-queue/mod-queue.tsx index ad5cdd80..c9a977d6 100644 --- a/src/views/mod-queue/mod-queue.tsx +++ b/src/views/mod-queue/mod-queue.tsx @@ -62,6 +62,9 @@ const ModQueueRow = ({ comment, showBoardColumn = false }: ModQueueRowProps) => const timeWaiting = Date.now() / 1000 - timestamp; const isOverThreshold = timeWaiting > alertThresholdHours * 3600; + // Only show alert animation for comments awaiting approval (not approved or rejected) + const isAwaitingApproval = !alreadyApproved && !alreadyRejected; + const { publishCommentModeration: approve, state: approveState, @@ -187,7 +190,9 @@ const ModQueueRow = ({ comment, showBoardColumn = false }: ModQueueRowProps) => {excerpt} )} -
{formatDistanceToNow(timestamp * 1000, { addSuffix: false })}
+
+ {formatDistanceToNow(timestamp * 1000, { addSuffix: false })} +
{renderActions()}
); @@ -265,19 +270,15 @@ export const ModQueueButton = ({ boardIdentifier, isMobile }: ModQueueButtonProp const { feed } = useFeed({ subplebbitAddresses: shouldFetch ? subplebbitAddresses : [], modQueue: ['pendingApproval'], - postsPerPage: 100, // Fetch enough to check timestamps + sortType: 'new', }); if (!shouldFetch || subplebbitAddresses.length === 0) { return null; } - // Sort feed by timestamp (oldest first) to match ModQueueView sorting - const sortedFeed = useMemo(() => { - return [...feed].sort((a, b) => a.timestamp - b.timestamp); - }, [feed]); - // Separate comments into normal and urgent based on threshold + // Only count items awaiting approval (not approved or rejected) for blinking counter // Match ModQueueRow logic: use > (strictly greater) to be consistent const { normalCount, urgentCount } = useMemo(() => { const thresholdSeconds = alertThresholdHours * 3600; @@ -286,7 +287,15 @@ export const ModQueueButton = ({ boardIdentifier, isMobile }: ModQueueButtonProp let normal = 0; let urgent = 0; - for (const item of sortedFeed) { + for (const item of feed) { + // Only count items that are awaiting approval (not approved or rejected) + const isAwaitingApproval = item.approved !== true && item.removed !== true; + + if (!isAwaitingApproval) { + // Skip items that are already approved or rejected + continue; + } + const timeWaiting = now - item.timestamp; if (timeWaiting > thresholdSeconds) { urgent++; @@ -296,7 +305,7 @@ export const ModQueueButton = ({ boardIdentifier, isMobile }: ModQueueButtonProp } return { normalCount: normal, urgentCount: urgent }; - }, [sortedFeed, alertThresholdHours]); + }, [feed, alertThresholdHours]); const totalCount = normalCount + urgentCount; @@ -372,11 +381,6 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV postsPerPage: 50, }); - // Sort feed by timestamp (oldest first) to show items waiting longest at the top - const sortedFeed = useMemo(() => { - return [...feed].sort((a, b) => a.timestamp - b.timestamp); - }, [feed]); - // Register reset function with feed reset store so refresh button works const setResetFunction = useFeedResetStore((state) => state.setResetFunction); useEffect(() => { @@ -434,7 +438,7 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV {!resolvedAddress && } - {sortedFeed.length === 0 && !hasMore ? ( + {feed.length === 0 && !hasMore ? (
{t('queue_is_empty')}
) : ( <> @@ -447,8 +451,8 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV } components={footerComponents}