Skip to content

Commit

Permalink
:rightwards_twisted_arrows: Merge with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
foysalit committed Nov 8, 2024
2 parents 161e545 + 990c4c9 commit b97a322
Show file tree
Hide file tree
Showing 12 changed files with 611 additions and 378 deletions.
72 changes: 48 additions & 24 deletions app/reports/page-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ import { ModActionPanelQuick } from '../actions/ModActionPanel/QuickAction'
import { ButtonGroup } from '@/common/buttons'
import { SubjectTable } from 'components/subject/table'
import { useTitle } from 'react-use'
import { LanguagePicker } from '@/common/LanguagePicker'
import { QueueSelector } from '@/reports/QueueSelector'
import { simpleHash, unique } from '@/lib/util'
import { useEmitEvent } from '@/mod-event/helpers/emitEvent'
import { useFluentReportSearchParams } from '@/reports/useFluentReportSearch'
import { useLabelerAgent } from '@/shell/ConfigurationContext'
import { WorkspacePanel } from 'components/workspace/Panel'
import { useWorkspaceOpener } from '@/common/useWorkspaceOpener'
import { EmbedTypePickerForModerationQueue } from '@/common/EmbedTypePicker'
import { useQueueSetting } from 'components/setting/useQueueSetting'
import QueueFilterPanel from '@/reports/QueueFilter/Panel'

const TABS = [
{
Expand Down Expand Up @@ -106,13 +105,15 @@ const ResolvedFilters = () => {
const appealed = params.get('appealed')

const updateParams = useCallback(
(key: string, newState: boolean) => {
(updates: Record<string, boolean>) => {
const nextParams = new URLSearchParams(params)
if (nextParams.get(key) == `${newState}`) {
nextParams.delete(key)
} else {
nextParams.set(key, `${newState}`)
}
Object.entries(updates).forEach(([key, newState]) => {
if (nextParams.get(key) === `${newState}`) {
nextParams.delete(key)
} else {
nextParams.set(key, `${newState}`)
}
})
router.push((pathname ?? '') + '?' + nextParams.toString())
},
[params, pathname, router],
Expand All @@ -126,20 +127,29 @@ const ResolvedFilters = () => {
{
id: 'takendown',
text: 'Taken Down',
onClick: () => updateParams('takendown', true),
onClick: () => updateParams({ takendown: true }),
isActive: takendown === 'true',
},
{
id: 'includeMuted',
text: 'Show Muted',
onClick: () => updateParams('includeMuted', true),
isActive: includeMuted === 'true',
},
{
id: 'onlyMuted',
text: 'Only Muted',
onClick: () => updateParams('onlyMuted', true),
isActive: onlyMuted === 'true',
id: 'mute',
text:
includeMuted === 'true'
? 'Include Muted'
: onlyMuted === 'true'
? 'Only Muted'
: 'Mutes',
onClick: () => {
// setting a param to it's current value toggles it off
// so we toggle off includeMuted and toggle on onlyMuted
if (includeMuted === 'true') {
updateParams({ includeMuted: true, onlyMuted: true })
} else if (onlyMuted === 'true') {
updateParams({ onlyMuted: true })
} else {
updateParams({ includeMuted: true })
}
},
isActive: includeMuted === 'true' || onlyMuted === 'true',
},
{
id: 'appealed',
Expand All @@ -151,12 +161,12 @@ const ResolvedFilters = () => {
: 'Appeals',
onClick: () => {
if (appealed === 'true') {
updateParams('appealed', false)
updateParams({ appealed: false })
} else if (appealed === 'false') {
// setting the same value toggles the param off
updateParams('appealed', false)
updateParams({ appealed: false })
} else {
updateParams('appealed', true)
updateParams({ appealed: true })
}
},
isActive: appealed === 'true' || appealed === 'false',
Expand Down Expand Up @@ -237,8 +247,7 @@ export const ReportsPageContent = () => {
</SectionHeader>
<div className="md:flex mt-2 mb-2 flex-row justify-between px-4 sm:px-6 lg:px-8">
<div className="flex flex-row items-center gap-2">
<LanguagePicker />
<EmbedTypePickerForModerationQueue />
<QueueFilterPanel />
</div>
<ResolvedFilters />
</div>
Expand Down Expand Up @@ -295,6 +304,8 @@ function useModerationQueueQuery() {
const tags = params.get('tags')
const excludeTags = params.get('excludeTags')
const queueName = params.get('queueName')
const subjectType = params.get('subjectType')
const collections = params.get('collections')
const { sortField, sortDirection } = getSortParams(params)
const { lastReviewedBy, subject, reporters, includeAllUserRecords } =
useFluentReportSearchParams()
Expand All @@ -317,6 +328,8 @@ function useModerationQueueQuery() {
queueName,
includeMuted,
onlyMuted,
subjectType,
collections,
},
],
queryFn: async ({ pageParam }) => {
Expand All @@ -330,6 +343,17 @@ function useModerationQueueQuery() {

if (subject) {
queryParams.subject = subject
} else {
if (subjectType) {
queryParams.subjectType = subjectType
}

if (subjectType === 'record') {
const collectionNames = collections?.split(',')
if (collectionNames?.length) {
queryParams.collections = collectionNames
}
}
}

if (takendown) {
Expand Down
2 changes: 1 addition & 1 deletion app/repositories/page-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export default function RepositoriesListPage() {

<RepositoriesTable
repos={repos}
showEmail={isEmailSearch(q)}
showEmail={isEmailSearch(q) || isSignatureSearch(q)}
onLoadMore={fetchNextPage}
showLoadMore={!!hasNextPage}
showEmptySearch={!q?.length && !repos.length}
Expand Down
86 changes: 0 additions & 86 deletions components/common/EmbedTypePicker.tsx

This file was deleted.

Loading

0 comments on commit b97a322

Please sign in to comment.