From eaef504449c36a0d36d446fa9514f9892777a7fa Mon Sep 17 00:00:00 2001 From: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com> Date: Sun, 15 Nov 2026 20:57:54 +0000 Subject: [PATCH] feat(tasks): filter GitHub tasks by several authors (#42450) * feat(tasks): filter GitHub tasks by several authors * fix(tasks): keep author candidates across picks * refactor(tasks): share author filter summary and only-me check --- .../list/work-item-list-request.test.ts | 21 ++++ .../client/list/work-item-list-request.ts | 8 +- .../client/list/work-item-search-query.ts | 6 +- .../components/github/PRFilterDropdowns.tsx | 28 +++-- .../src/components/github/PRFilterPickers.tsx | 107 +++++++++++------- .../components/github/PRFilterSections.tsx | 24 +--- .../github/pr-filter-value-summary.ts | 27 +++++ .../github/listing/task-page-pr-chips.ts | 23 ++-- .../listing/task-page-preset-highlight.ts | 5 +- .../src/i18n/en-runtime-required.json | 4 +- src/renderer/src/i18n/locales/de.json | 2 + src/renderer/src/i18n/locales/en.json | 2 + src/renderer/src/i18n/locales/es.json | 3 + src/renderer/src/i18n/locales/fr.json | 3 + src/renderer/src/i18n/locales/ja.json | 1 + src/renderer/src/i18n/locales/ko.json | 1 + src/renderer/src/i18n/locales/pt.json | 3 + src/renderer/src/i18n/locales/ru.json | 4 + src/renderer/src/i18n/locales/tr.json | 2 + src/renderer/src/i18n/locales/zh-Hant.json | 1 + src/renderer/src/i18n/locales/zh.json | 1 + src/shared/work-items/task-query.test.ts | 4 +- src/shared/work-items/task-query.ts | 18 +-- 23 files changed, 202 insertions(+), 96 deletions(-) create mode 100644 src/main/github/client/list/work-item-list-request.test.ts create mode 100644 src/renderer/src/components/github/pr-filter-value-summary.ts diff --git a/src/main/github/client/list/work-item-list-request.test.ts b/src/main/github/client/list/work-item-list-request.test.ts new file mode 100644 index 00000000000..29d30d54caa --- /dev/null +++ b/src/main/github/client/list/work-item-list-request.test.ts @@ -0,0 +1,21 @@ +import { describe, expect, it } from 'vitest' +import { parseTaskQuery } from '../../../../shared/work-items/task-query' +import { buildWorkItemListRequest } from './work-item-list-request' + +const ownerRepo = { owner: 'acme', repo: 'widgets' } + +describe('buildWorkItemListRequest', () => { + it('ORs several authors in the grammar each GitHub search understands', () => { + const query = parseTaskQuery('is:open author:alice author:bob') + const issues = buildWorkItemListRequest({ kind: 'issue', ownerRepo, limit: 20, query, page: 1 }) + const prs = buildWorkItemListRequest({ kind: 'pr', ownerRepo, limit: 20, query, page: 1 }) + + expect(issues.search).toBe('repo:acme/widgets is:issue is:open author:alice author:bob') + expect(prs.search).toBe( + '( is:open (author:alice OR author:bob) sort:created-desc ) repo:acme/widgets type:pr' + ) + expect(prs.args.at(prs.args.indexOf('--search') + 1)).toBe( + 'is:open (author:alice OR author:bob) sort:created-desc' + ) + }) +}) diff --git a/src/main/github/client/list/work-item-list-request.ts b/src/main/github/client/list/work-item-list-request.ts index c76d333b46b..a40d6f4cea8 100644 --- a/src/main/github/client/list/work-item-list-request.ts +++ b/src/main/github/client/list/work-item-list-request.ts @@ -54,8 +54,12 @@ export function buildWorkItemListRequest(args: { if (query.assignee) { searchParts.push(`assignee:${quoteGitHubSearchValue(query.assignee)}`) } - if (query.author) { - searchParts.push(`author:${quoteGitHubSearchValue(query.author)}`) + const authorTerms = query.authors.map((author) => `author:${quoteGitHubSearchValue(author)}`) + // search/issues ORs repeated author:, but gh pr list's advanced search ANDs them. + if (kind === 'pr' && authorTerms.length > 1) { + searchParts.push(`(${authorTerms.join(' OR ')})`) + } else { + searchParts.push(...authorTerms) } if (query.labels.length > 0) { for (const label of query.labels) { diff --git a/src/main/github/client/list/work-item-search-query.ts b/src/main/github/client/list/work-item-search-query.ts index bbcbd089004..a0c827cbac2 100644 --- a/src/main/github/client/list/work-item-search-query.ts +++ b/src/main/github/client/list/work-item-search-query.ts @@ -29,8 +29,8 @@ export function buildSearchQueryString( if (query.assignee) { parts.push(`assignee:${quoteGitHubSearchValue(query.assignee)}`) } - if (query.author) { - parts.push(`author:${quoteGitHubSearchValue(query.author)}`) + for (const author of query.authors) { + parts.push(`author:${quoteGitHubSearchValue(author)}`) } if (query.reviewRequested) { parts.push(`review-requested:${quoteGitHubSearchValue(query.reviewRequested)}`) @@ -57,7 +57,7 @@ export function defaultOpenWorkItemQuery(): ParsedTaskQuery { state: 'open', draft: false, assignee: null, - author: null, + authors: [], reviewRequested: null, reviewedBy: null, labels: [], diff --git a/src/renderer/src/components/github/PRFilterDropdowns.tsx b/src/renderer/src/components/github/PRFilterDropdowns.tsx index 9160fec710e..e06aaa3257f 100644 --- a/src/renderer/src/components/github/PRFilterDropdowns.tsx +++ b/src/renderer/src/components/github/PRFilterDropdowns.tsx @@ -5,9 +5,9 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover import { cn } from '@/lib/class-names' import { useRepoLabelsBySlug, useRepoAssigneesBySlug } from '@/hooks/useGitHubSlugMetadata' import type { PickerOption } from '@/components/github/PRFilterPickers' +import { filterAuthorsValue, filterLabelsValue } from '@/components/github/pr-filter-value-summary' import { filterDraftLabel, - filterLabelsValue, filterStateLabel, SectionDetail, SectionMenu, @@ -83,6 +83,8 @@ export default function PRFilterDropdowns({ const t = useTranslate() const [openSection, setOpenSection] = useState(null) const [popoverOpen, setPopoverOpen] = useState(false) + // Each author pick reloads the list, so keep the authors visible at open as candidates. + const [authorLoginsAtOpen, setAuthorLoginsAtOpen] = useState([]) const owner = primarySlug?.owner ?? null const repo = primarySlug?.repo ?? null const hasPrimarySlug = popoverOpen && owner !== null && repo !== null @@ -117,14 +119,16 @@ export default function PRFilterDropdowns({ secondary: currentUserLabel() }) // Use visible authors because assignable-user metadata excludes outside contributors. - for (const login of authorLogins) { + for (const login of [...authorLoginsAtOpen, ...authorLogins]) { options.set(login.toLowerCase(), { key: login, primary: login }) } - if (parsed.author && !options.has(parsed.author.toLowerCase())) { - options.set(parsed.author.toLowerCase(), { key: parsed.author, primary: parsed.author }) + // Key options by the query's casing so the picker's selection matches them. + for (const author of parsed.authors) { + const lower = author.toLowerCase() + options.set(lower, { ...(options.get(lower) ?? { primary: author }), key: author }) } return [...options.values()] - }, [authorLogins, parsed.author]) + }, [authorLoginsAtOpen, authorLogins, parsed.authors]) const labelOpts = useMemo( () => (hasPrimarySlug ? labelsState.data.map((name) => ({ key: name, primary: name })) : []), [hasPrimarySlug, labelsState.data] @@ -154,7 +158,7 @@ export default function PRFilterDropdowns({ const activeCount = (statusActive ? 1 : 0) + - (parsed.author ? 1 : 0) + + (parsed.authors.length > 0 ? 1 : 0) + (parsed.assignee ? 1 : 0) + (reviewerActive ? 1 : 0) + (parsed.labels.length > 0 ? 1 : 0) @@ -170,7 +174,9 @@ export default function PRFilterDropdowns({ open={popoverOpen} onOpenChange={(next) => { setPopoverOpen(next) - if (!next) { + if (next) { + setAuthorLoginsAtOpen(authorLogins) + } else { setOpenSection(null) } }} @@ -212,7 +218,7 @@ export default function PRFilterDropdowns({ activeCount > 0 ? () => { onChange({ - author: null, + authors: [], assignee: null, reviewer: null, labels: [], @@ -252,11 +258,11 @@ export default function PRFilterDropdowns({ onClear={() => onChange({ state: 'open', draft: false })} /> ) : null} - {parsed.author ? ( + {parsed.authors.length > 0 ? ( onChange({ author: null })} + value={filterAuthorsValue(parsed.authors, t) ?? ''} + onClear={() => onChange({ authors: [] })} /> ) : null} {parsed.labels.length > 0 ? ( diff --git a/src/renderer/src/components/github/PRFilterPickers.tsx b/src/renderer/src/components/github/PRFilterPickers.tsx index 20c4e53110e..d5f9b645398 100644 --- a/src/renderer/src/components/github/PRFilterPickers.tsx +++ b/src/renderer/src/components/github/PRFilterPickers.tsx @@ -54,11 +54,13 @@ export function filterPullRequestPickerOptions( function pickerFallbackText( { + customValue, loading, queryTooLarge, error, emptyText }: { + customValue: string | null loading: boolean queryTooLarge: boolean error: string | null @@ -66,6 +68,12 @@ function pickerFallbackText( }, t: Translate = translate ): string { + if (customValue) { + return t( + 'auto.components.github.PRFilterPickers.pressEnterToUseValue', + 'Press Enter to use the typed value.' + ) + } if (loading) { return t('auto.components.github.PRFilterPickers.loading', 'Loading…') } @@ -78,6 +86,47 @@ function pickerFallbackText( return error ?? emptyText ?? t('auto.components.github.PRFilterPickers.noMatches', 'No matches') } +// Allow external authors/reviewers missing from the collaborator-only assignable-user list. +function customPickerValue( + filtered: PickerOption[], + { queryTooLarge, trimmedQuery }: ReturnType, + allowCustomValue: boolean | undefined +): string | null { + const show = + allowCustomValue && + trimmedQuery.length > 0 && + !queryTooLarge && + !filtered.some((o) => o.key.toLowerCase() === trimmedQuery.toLowerCase()) + return show ? trimmedQuery : null +} + +function CustomValueItem({ + value, + onSelect +}: { + value: string + onSelect: () => void +}): React.JSX.Element { + const t = useTranslate() + return ( + + + ')} + components={{ + value: {value} + }} + /> + + + ) +} + export function SingleSelectList({ options, activeValue, @@ -96,25 +145,16 @@ export function SingleSelectList({ searchPlaceholder: string emptyText?: string renderOption?: (opt: PickerOption) => React.ReactNode - // Allow external authors/reviewers missing from the collaborator-only assignable-user list. allowCustomValue?: boolean onSelect: (value: string | null) => void }): React.JSX.Element { const t = useTranslate() const [query, setQuery] = useState('') const filtered = useMemo(() => filterPullRequestPickerOptions(options, query), [options, query]) - const { queryTooLarge, trimmedQuery } = getPullRequestPickerQueryState(query) - const showCustom = - allowCustomValue && - trimmedQuery.length > 0 && - !queryTooLarge && - !filtered.some((o) => o.key.toLowerCase() === trimmedQuery.toLowerCase()) - const fallback = showCustom - ? t( - 'auto.components.github.PRFilterPickers.pressEnterToUseValue', - 'Press Enter to use the typed value.' - ) - : pickerFallbackText({ loading, queryTooLarge, error, emptyText }, t) + const queryState = getPullRequestPickerQueryState(query) + const { queryTooLarge } = queryState + const customValue = customPickerValue(filtered, queryState, allowCustomValue) + const fallback = pickerFallbackText({ customValue, loading, queryTooLarge, error, emptyText }, t) return ( @@ -126,22 +166,8 @@ export function SingleSelectList({ /> {fallback} - {showCustom ? ( - onSelect(trimmedQuery)} - className="items-center gap-2 px-3 py-1.5 text-xs" - > - - ')} - components={{ - value: {trimmedQuery} - }} - /> - - + {customValue ? ( + onSelect(customValue)} /> ) : null} {activeValue ? ( React.ReactNode + allowCustomValue?: boolean onChange: (next: string[]) => void }): React.JSX.Element { const t = useTranslate() const [query, setQuery] = useState('') const filtered = useMemo(() => filterPullRequestPickerOptions(options, query), [options, query]) const selectedSet = useMemo(() => new Set(selected), [selected]) - const { queryTooLarge } = getPullRequestPickerQueryState(query) - const fallback = pickerFallbackText( - { - loading, - queryTooLarge, - error, - emptyText - }, - t - ) + const queryState = getPullRequestPickerQueryState(query) + const { queryTooLarge } = queryState + const customValue = customPickerValue(filtered, queryState, allowCustomValue) + const fallback = pickerFallbackText({ customValue, loading, queryTooLarge, error, emptyText }, t) const toggle = (key: string): void => { const next = new Set(selectedSet) @@ -228,6 +252,9 @@ export function MultiSelectList({ /> {fallback} + {customValue ? ( + toggle(customValue)} /> + ) : null} {selected.length > 0 ? ( - {opt.primary} + {renderOption ? renderOption(opt) : {opt.primary}} ) })} diff --git a/src/renderer/src/components/github/PRFilterSections.tsx b/src/renderer/src/components/github/PRFilterSections.tsx index 92bb7925dc4..1224a9efe00 100644 --- a/src/renderer/src/components/github/PRFilterSections.tsx +++ b/src/renderer/src/components/github/PRFilterSections.tsx @@ -6,12 +6,13 @@ import { type PickerOption } from '@/components/github/PRFilterPickers' import { cn } from '@/lib/class-names' +import { filterAuthorsValue, filterLabelsValue } from '@/components/github/pr-filter-value-summary' import type { ParsedTaskQuery } from '../../../../shared/work-items/task-query' import { translate } from '@/i18n/i18n' import { useTranslate, type Translate } from '@/i18n/use-translate' export type PRFilterChange = { - author?: string | null + authors?: string[] assignee?: string | null reviewer?: { kind: 'requested' | 'reviewed-by'; login: string } | null labels?: string[] @@ -38,19 +39,6 @@ export function filterDraftLabel(t: Translate = translate): string { return t('auto.components.github.PRFilterSections.draft', 'Draft') } -export function filterLabelsValue(labels: string[], t: Translate = translate): string | null { - if (labels.length === 0) { - return null - } - if (labels.length === 1) { - return labels[0] - } - return t('auto.components.github.PRFilterSections.labelCount', '{{count}} labels', { - count: labels.length, - defaultValue_one: '{{count}} label' - }) -} - function statusLabel(parsed: ParsedTaskQuery, t: Translate = translate): string { const parts: string[] = [] if (parsed.state === 'all') { @@ -207,7 +195,7 @@ export function SectionMenu({ { key: 'author', label: t('auto.components.github.PRFilterSections.24754c44ad', 'Author'), - value: parsed.author + value: filterAuthorsValue(parsed.authors, t) }, { key: 'label', @@ -315,9 +303,9 @@ export function SectionDetail({ ) : null} {section === 'author' ? ( - } - onSelect={(value) => onSelect({ author: value })} + onChange={(next) => onSelect({ authors: next })} /> ) : null} {section === 'assignee' ? ( diff --git a/src/renderer/src/components/github/pr-filter-value-summary.ts b/src/renderer/src/components/github/pr-filter-value-summary.ts new file mode 100644 index 00000000000..1e77c6a39e2 --- /dev/null +++ b/src/renderer/src/components/github/pr-filter-value-summary.ts @@ -0,0 +1,27 @@ +import { translate } from '@/i18n/i18n' +import type { Translate } from '@/i18n/use-translate' + +function filterValuesSummary( + values: string[], + countText: (count: number) => string +): string | null { + return values.length > 1 ? countText(values.length) : (values[0] ?? null) +} + +export function filterLabelsValue(labels: string[], t: Translate = translate): string | null { + return filterValuesSummary(labels, (count) => + t('auto.components.github.PRFilterSections.labelCount', '{{count}} labels', { + count, + defaultValue_one: '{{count}} label' + }) + ) +} + +export function filterAuthorsValue(authors: string[], t: Translate = translate): string | null { + return filterValuesSummary(authors, (count) => + t('auto.components.github.PRFilterSections.authorCount', '{{count}} authors', { + count, + defaultValue_one: '{{count}} author' + }) + ) +} diff --git a/src/renderer/src/components/task-page/github/listing/task-page-pr-chips.ts b/src/renderer/src/components/task-page/github/listing/task-page-pr-chips.ts index 650765e22ea..58d6f1ccb32 100644 --- a/src/renderer/src/components/task-page/github/listing/task-page-pr-chips.ts +++ b/src/renderer/src/components/task-page/github/listing/task-page-pr-chips.ts @@ -21,8 +21,8 @@ const PR_PRESET_BY_WHO: Record = { /** Patch the query's qualifiers, keeping every other filter and free text. */ export function patchGitHubTaskQuery(query: string, change: PRFilterChange): string { let next = query - if ('author' in change) { - next = withQualifier(next, 'author', change.author ?? null) + if ('authors' in change) { + next = withQualifier(next, 'authors', change.authors ?? []) } if ('assignee' in change) { next = withQualifier(next, 'assignee', change.assignee ?? null) @@ -72,29 +72,36 @@ export function deriveGitHubPRStateChip(query: ParsedTaskQuery): GitHubPRStateCh return query.state === null ? 'all' : query.state } +function isMe(login: string | null): boolean { + return login?.toLowerCase() === '@me' +} + +export function isOnlyMeAuthor(query: ParsedTaskQuery): boolean { + return query.authors.length === 1 && isMe(query.authors[0]) +} + /** Who means author or reviewer, independent of assignee, labels and text; other people light no chip. */ export function deriveGitHubPRWhoChip(query: ParsedTaskQuery): GitHubPRWhoChip | null { - const isMe = (login: string | null): boolean => login?.toLowerCase() === '@me' if (query.reviewedBy !== null) { return null } - if (query.author === null) { + if (query.authors.length === 0) { if (query.reviewRequested === null) { return 'everyone' } return isMe(query.reviewRequested) ? 'reviewing' : null } - return query.reviewRequested === null && isMe(query.author) ? 'mine' : null + return query.reviewRequested === null && isOnlyMeAuthor(query) ? 'mine' : null } export function gitHubPRWhoChange(who: GitHubPRWhoChip): PRFilterChange { if (who === 'mine') { - return { author: '@me', reviewer: null } + return { authors: ['@me'], reviewer: null } } if (who === 'reviewing') { - return { author: null, reviewer: { kind: 'requested', login: '@me' } } + return { authors: [], reviewer: { kind: 'requested', login: '@me' } } } - return { author: null, reviewer: null } + return { authors: [], reviewer: null } } export function gitHubPRWhoPreset(who: GitHubPRWhoChip): TaskViewPresetId { diff --git a/src/renderer/src/components/task-page/github/listing/task-page-preset-highlight.ts b/src/renderer/src/components/task-page/github/listing/task-page-preset-highlight.ts index 2793368b7b7..89b7812d192 100644 --- a/src/renderer/src/components/task-page/github/listing/task-page-preset-highlight.ts +++ b/src/renderer/src/components/task-page/github/listing/task-page-preset-highlight.ts @@ -1,6 +1,7 @@ import type { ParsedTaskQuery } from '../../../../../../shared/work-items/task-query' import type { GitHubTaskKind } from '../../../../../../shared/work-items/task-github-search' import type { TaskViewPresetId } from '../../../../../../shared/ui-chrome-types' +import { isOnlyMeAuthor } from './task-page-pr-chips' export function deriveGitHubTaskPreset( kind: GitHubTaskKind, query: ParsedTaskQuery @@ -9,7 +10,7 @@ export function deriveGitHubTaskPreset( return null } if (kind === 'prs') { - if (query.author?.toLowerCase() === '@me') { + if (isOnlyMeAuthor(query)) { return 'my-prs' } if (query.reviewRequested?.toLowerCase() === '@me') { @@ -18,7 +19,7 @@ export function deriveGitHubTaskPreset( } else if (query.assignee?.toLowerCase() === '@me') { return 'my-issues' } - return query.author !== null || + return query.authors.length > 0 || query.assignee !== null || query.reviewRequested !== null || query.reviewedBy !== null diff --git a/src/renderer/src/i18n/en-runtime-required.json b/src/renderer/src/i18n/en-runtime-required.json index 85286929664..28e178063a3 100644 --- a/src/renderer/src/i18n/en-runtime-required.json +++ b/src/renderer/src/i18n/en-runtime-required.json @@ -331,7 +331,9 @@ "github": { "PRFilterSections": { "labelCount_one": "{{count}} label", - "labelCount_other": "{{count}} labels" + "labelCount_other": "{{count}} labels", + "authorCount_one": "{{count}} author", + "authorCount_other": "{{count}} authors" }, "project": { "ProjectPicker": { diff --git a/src/renderer/src/i18n/locales/de.json b/src/renderer/src/i18n/locales/de.json index 29427c8582c..a0d23205735 100644 --- a/src/renderer/src/i18n/locales/de.json +++ b/src/renderer/src/i18n/locales/de.json @@ -3625,6 +3625,8 @@ "draft": "Entwurf", "labelCount_one": "{{count}} Label", "labelCount_other": "{{count}} Labels", + "authorCount_one": "{{count}} Autor", + "authorCount_other": "{{count}} Autoren", "allStates": "Alle", "filterPullRequests": "Pull Requests filtern", "filterIssues": "Issues filtern", diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index da0186ac260..361f01bcfbe 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -4234,6 +4234,8 @@ "draft": "Draft", "labelCount_one": "{{count}} label", "labelCount_other": "{{count}} labels", + "authorCount_one": "{{count}} author", + "authorCount_other": "{{count}} authors", "allStates": "All", "filterPullRequests": "Filter pull requests", "filterIssues": "Filter issues", diff --git a/src/renderer/src/i18n/locales/es.json b/src/renderer/src/i18n/locales/es.json index d662da52b63..4f2bdea9c02 100644 --- a/src/renderer/src/i18n/locales/es.json +++ b/src/renderer/src/i18n/locales/es.json @@ -3113,6 +3113,9 @@ "labelCount_one": "{{count}} etiqueta", "labelCount_other": "{{count}} etiquetas", "labelCount_many": "{{count}} etiquetas", + "authorCount_one": "{{count}} autor", + "authorCount_other": "{{count}} autores", + "authorCount_many": "{{count}} autores", "allStates": "Todos", "filterPullRequests": "Filtrar pull requests", "filterIssues": "Filtrar issues", diff --git a/src/renderer/src/i18n/locales/fr.json b/src/renderer/src/i18n/locales/fr.json index 30aceafd582..587e5e33fed 100644 --- a/src/renderer/src/i18n/locales/fr.json +++ b/src/renderer/src/i18n/locales/fr.json @@ -3384,6 +3384,9 @@ "labelCount_one": "{{count}} étiquette", "labelCount_other": "{{count}} étiquettes", "labelCount_many": "{{count}} étiquettes", + "authorCount_one": "{{count}} auteur", + "authorCount_other": "{{count}} auteurs", + "authorCount_many": "{{count}} auteurs", "allStates": "Tous", "filterPullRequests": "Filtrer les pull requests", "filterIssues": "Filtrer les issues", diff --git a/src/renderer/src/i18n/locales/ja.json b/src/renderer/src/i18n/locales/ja.json index 436048b13fb..51c51d4ca99 100644 --- a/src/renderer/src/i18n/locales/ja.json +++ b/src/renderer/src/i18n/locales/ja.json @@ -3059,6 +3059,7 @@ "bd162b7d5a": "マージ済み", "draft": "下書き", "labelCount_other": "{{count}} 個のラベル", + "authorCount_other": "{{count}} 人の著者", "allStates": "全て", "filterPullRequests": "PR を絞り込む", "filterIssues": "Issue を絞り込む", diff --git a/src/renderer/src/i18n/locales/ko.json b/src/renderer/src/i18n/locales/ko.json index 44d44c20298..9c40ba614a1 100644 --- a/src/renderer/src/i18n/locales/ko.json +++ b/src/renderer/src/i18n/locales/ko.json @@ -3059,6 +3059,7 @@ "bd162b7d5a": "병합됨", "draft": "초안", "labelCount_other": "라벨 {{count}}개", + "authorCount_other": "작성자 {{count}}명", "allStates": "모두", "filterPullRequests": "PR 필터링", "filterIssues": "이슈 필터링", diff --git a/src/renderer/src/i18n/locales/pt.json b/src/renderer/src/i18n/locales/pt.json index 7e5d52b7584..221da547a59 100644 --- a/src/renderer/src/i18n/locales/pt.json +++ b/src/renderer/src/i18n/locales/pt.json @@ -16380,6 +16380,9 @@ "labelCount_one": "{{count}} rótulo", "labelCount_other": "{{count}} rótulos", "labelCount_many": "{{count}} rótulos", + "authorCount_one": "{{count}} autor", + "authorCount_other": "{{count}} autores", + "authorCount_many": "{{count}} autores", "allStates": "Todos", "filterPullRequests": "Filtrar pull requests", "filterIssues": "Filtrar issues", diff --git a/src/renderer/src/i18n/locales/ru.json b/src/renderer/src/i18n/locales/ru.json index ee5231154fe..86a09e184c7 100644 --- a/src/renderer/src/i18n/locales/ru.json +++ b/src/renderer/src/i18n/locales/ru.json @@ -3712,6 +3712,10 @@ "labelCount_few": "{{count}} метки", "labelCount_many": "{{count}} меток", "labelCount_other": "{{count}} метки", + "authorCount_one": "{{count}} автор", + "authorCount_few": "{{count}} автора", + "authorCount_many": "{{count}} авторов", + "authorCount_other": "{{count}} автора", "allStates": "Все", "filterPullRequests": "Фильтр пул-реквестов", "filterIssues": "Фильтр задач", diff --git a/src/renderer/src/i18n/locales/tr.json b/src/renderer/src/i18n/locales/tr.json index 860f9169c0c..028ae13eab5 100644 --- a/src/renderer/src/i18n/locales/tr.json +++ b/src/renderer/src/i18n/locales/tr.json @@ -3594,6 +3594,8 @@ "draft": "Taslak", "labelCount_other": "{{count}} etiket", "labelCount_one": "{{count}} etiket", + "authorCount_other": "{{count}} yazar", + "authorCount_one": "{{count}} yazar", "allStates": "Tümü", "filterPullRequests": "Pull request'leri filtrele", "filterIssues": "Sorunları filtrele", diff --git a/src/renderer/src/i18n/locales/zh-Hant.json b/src/renderer/src/i18n/locales/zh-Hant.json index f19cd70ed91..932e8e4e59e 100644 --- a/src/renderer/src/i18n/locales/zh-Hant.json +++ b/src/renderer/src/i18n/locales/zh-Hant.json @@ -3552,6 +3552,7 @@ "bd162b7d5a": "已合併", "draft": "草稿", "labelCount_other": "{{count}} 個標籤", + "authorCount_other": "{{count}} 位作者", "allStates": "全部", "filterPullRequests": "篩選 PR", "filterIssues": "篩選議題", diff --git a/src/renderer/src/i18n/locales/zh.json b/src/renderer/src/i18n/locales/zh.json index a84a802729f..56ef4517ce7 100644 --- a/src/renderer/src/i18n/locales/zh.json +++ b/src/renderer/src/i18n/locales/zh.json @@ -3250,6 +3250,7 @@ "bd162b7d5a": "合并", "draft": "草稿", "labelCount_other": "{{count}} 个标签", + "authorCount_other": "{{count}} 位作者", "allStates": "全部", "filterPullRequests": "筛选 PR", "filterIssues": "筛选议题", diff --git a/src/shared/work-items/task-query.test.ts b/src/shared/work-items/task-query.test.ts index 48444bd94c2..9af615a88dc 100644 --- a/src/shared/work-items/task-query.test.ts +++ b/src/shared/work-items/task-query.test.ts @@ -36,10 +36,10 @@ describe('parseTaskQuery', () => { it('extracts assignee, author, label, and review qualifiers', () => { const parsed = parseTaskQuery( - 'assignee:@me author:alice review-requested:@me label:bug free text' + 'assignee:@me author:alice author:bob review-requested:@me label:bug free text' ) expect(parsed.assignee).toBe('@me') - expect(parsed.author).toBe('alice') + expect(parsed.authors).toEqual(['alice', 'bob']) expect(parsed.reviewRequested).toBe('@me') expect(parsed.scope).toBe('pr') // review-requested forces pr expect(parsed.labels).toEqual(['bug']) diff --git a/src/shared/work-items/task-query.ts b/src/shared/work-items/task-query.ts index 22f5d23f687..183140766bd 100644 --- a/src/shared/work-items/task-query.ts +++ b/src/shared/work-items/task-query.ts @@ -3,7 +3,7 @@ export type ParsedTaskQuery = { state: 'open' | 'closed' | 'all' | 'merged' | null draft: boolean assignee: string | null - author: string | null + authors: string[] reviewRequested: string | null reviewedBy: string | null labels: string[] @@ -66,7 +66,7 @@ export function parseTaskQuery(rawQuery: string): ParsedTaskQuery { state: null, draft: false, assignee: null, - author: null, + authors: [], reviewRequested: null, reviewedBy: null, labels: [], @@ -124,7 +124,7 @@ export function parseTaskQuery(rawQuery: string): ParsedTaskQuery { continue } if (key === 'author') { - query.author = value + query.authors.push(value) continue } if (key === 'review-requested') { @@ -195,8 +195,8 @@ export function serializeTaskQuery(q: ParsedTaskQuery): string { if (q.draft) { parts.push('is:draft') } - if (q.author) { - parts.push(`author:${quoteIfNeeded(q.author)}`) + for (const author of q.authors) { + parts.push(`author:${quoteIfNeeded(author)}`) } if (q.assignee) { parts.push(`assignee:${quoteIfNeeded(q.assignee)}`) @@ -217,7 +217,7 @@ export function serializeTaskQuery(q: ParsedTaskQuery): string { } export type TaskQueryFilterKey = - | 'author' + | 'authors' | 'assignee' | 'reviewRequested' | 'reviewedBy' @@ -225,7 +225,7 @@ export type TaskQueryFilterKey = | 'state' | 'draft' -/** Single-value null clears the qualifier; labels replaces the full array (caller manages membership). */ +/** Single-value null clears the qualifier; authors and labels replace the full array (caller manages membership). */ export function withQualifier( rawQuery: string, key: TaskQueryFilterKey, @@ -233,8 +233,8 @@ export function withQualifier( ): string { const parsed = parseTaskQuery(rawQuery) switch (key) { - case 'author': - parsed.author = typeof value === 'string' ? value : null + case 'authors': + parsed.authors = Array.isArray(value) ? value : [] break case 'assignee': parsed.assignee = typeof value === 'string' ? value : null