Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions source/features/open-all-conversations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import observe from '../helpers/selector-observer.js';

function onButtonClick(): void {
const links = $$([
// Issue list
'a[data-testid="issue-pr-title-link"]',
'a.h4.js-navigation-open', // TODO: Pre-React selector; Drop in 2026
// PR list -- TODO: Drop after global and repo PR lists become exclusively React-based
'a.h4.js-navigation-open',
]);

if (links.length > 25) {
Expand All @@ -20,7 +22,9 @@ function onButtonClick(): void {

const selectedLinks = links.filter(link =>
$closestOptional([
'.js-issue-row.selected', // TODO: Pre-React selector; Drop in 2026
// PR list -- TODO: Drop after global and repo PR lists become exclusively React-based
'.js-issue-row.selected',
// Issue list
'[aria-label^="Selected"]',
], link),
);
Expand All @@ -33,19 +37,25 @@ function onButtonClick(): void {
void openTabs(urls);
}

const multipleConversationsSelector = [
'.js-issue-row + .js-issue-row', // TODO: Pre-React selector; Drop in 2026
'[role="list"] > div:nth-child(2) > [class^="IssueRow"]',
] as const;

async function hasMoreThanOneConversation(): Promise<boolean> {
return Boolean(await elementReady(multipleConversationsSelector, {waitForChildren: false}));
const list = await elementReady(
[
// Issue list
'ul[data-listview-component="items-list"]',
// PR list -- TODO: Drop after global and repo PR lists become exclusively React-based
'#js-issues-toolbar ~ div > div',
],
{stopOnDomReady: false, waitForChildren: false},
);
return !pageDetect.isBlank() && list!.childElementCount > 1;
}

function add(anchor: HTMLElement): void {
const isLegacy = $closestOptional('.table-list-header-toggle', anchor);
const isSelected = $closestOptional([
'.table-list-triage', // TODO: Pre-React selector; Drop in 2026
// PR list -- TODO: Drop after global and repo PR lists become exclusively React-based
'.table-list-triage',
// Issue list
'[aria-label="Bulk actions"]',
], anchor);
const classes = isLegacy
Expand All @@ -68,7 +78,9 @@ function add(anchor: HTMLElement): void {
async function init(signal: AbortSignal): Promise<void | false> {
observe(
[
'.table-list-header-toggle:not(.states)', // TODO: Pre-React selector; Drop in 2026
// PR list -- TODO: Drop after global and repo PR lists become exclusively React-based
'.table-list-header-toggle:not(.states)',
// Issue list
'[aria-label="Bulk actions"] > :first-child',
'[aria-label="Actions"] > :first-child',
],
Expand All @@ -85,14 +97,6 @@ void features.add(import.meta.url, {
include: [
pageDetect.isIssueOrPRList,
],
exclude: [
pageDetect.isGlobalIssueOrPRList,
],
init,
}, {
include: [
pageDetect.isGlobalIssueOrPRList,
],
init,
});

Expand Down
Loading