diff options
author | 2023-02-01 13:25:24 +0800 | |
---|---|---|
committer | 2023-02-01 13:25:24 +0800 | |
commit | be264ed3d865bec38e44eaa1cb7d0a1b9e455ff6 (patch) | |
tree | 7b9b2534e8eb76ba1436c2170cab817256672bd5 /source/features/mark-merge-commits-in-list.tsx | |
parent | 97efeef70fd850b2d72251e4391f0e28b933ba4e (diff) | |
download | refined-github-be264ed3d865bec38e44eaa1cb7d0a1b9e455ff6.tar.gz refined-github-be264ed3d865bec38e44eaa1cb7d0a1b9e455ff6.tar.zst refined-github-be264ed3d865bec38e44eaa1cb7d0a1b9e455ff6.zip |
Restore `mark-merge-commits-in-list` in PRs (#6246)
Diffstat (limited to 'source/features/mark-merge-commits-in-list.tsx')
-rw-r--r-- | source/features/mark-merge-commits-in-list.tsx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/features/mark-merge-commits-in-list.tsx b/source/features/mark-merge-commits-in-list.tsx index 7fb5e9c7..fd9c8d75 100644 --- a/source/features/mark-merge-commits-in-list.tsx +++ b/source/features/mark-merge-commits-in-list.tsx @@ -40,8 +40,13 @@ export function getCommitHash(commit: HTMLElement): string { async function init(): Promise<void> { const pageCommits = select.all([ '.js-commits-list-item', // `isCommitList` - '[data-test-selector="pr-timeline-commits-list"] .TimelineItem', // `isPRConversation` + '.js-timeline-item .TimelineItem:has(.octicon-git-commit)', // `isPRConversation`, "js-timeline-item" to exclude "isCommitList" ].join(',')); + + if (pageCommits.length === 0) { + throw new Error('No commits found, selector likely out of date'); + } + const mergeCommits = await filterMergeCommits(pageCommits.map(commit => getCommitHash(commit))); for (const commit of pageCommits) { if (mergeCommits.includes(getCommitHash(commit))) { @@ -60,3 +65,14 @@ void features.add(import.meta.url, { deduplicate: 'has-rgh-inner', init, }); + +/* + +Test URLs + +- isPRConversation: https://github.com/refined-github/refined-github/pull/6194 +- isPRCommitList: https://github.com/refined-github/refined-github/pull/6194/commits +- isCommitList: https://github.com/babel/babel/commits/master?after=ddd40bf5c7ad8565fc990f26142f85613958a329+104 +- isCompare: https://github.com/refined-github/sandbox/compare/e8b25d3e...b3d0d992 + +*/ |