Skip to content

Commit f3cb5cb

Browse files
Fix: Stop reopening sticky threads once closed
1 parent f890a05 commit f3cb5cb

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/azdo-pr-dashboard.user.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22

33
// @name AzDO Pull Request Improvements
4-
// @version 2.23.3
4+
// @version 2.23.4
55
// @author Alejandro Barreto (National Instruments)
66
// @description Adds sorting and categorization to the PR dashboard. Also adds minor improvements to the PR diff experience, such as a base update selector and per-file checkboxes.
77
// @license MIT
@@ -73,10 +73,12 @@
7373
}`);
7474

7575
// Expand threads that have the sticky prefix.
76-
$('.discussion-thread-host button.ms-Button.expand-button').once('expand-sticky-threads-on-load').each(function () {
77-
// jQuery doesn't support case-insensitive string compares, so we need to drop into JS to find the prefix in the button's label.
78-
if (this.getAttribute('aria-label').toLowerCase().includes(`: "${lowerCasePrefix}`)) {
79-
this.click();
76+
const lowerCasePrefixCssSelector = CSS.escape(`: "${lowerCasePrefix}`);
77+
$('.discussion-thread-host').once('expand-sticky-threads-on-load').each(async function () {
78+
await sleep(100);
79+
const button = this.querySelector(`button.ms-Button.expand-button[aria-label*="${lowerCasePrefixCssSelector}" i]`);
80+
if (button) {
81+
button.click();
8082
}
8183
});
8284
}

0 commit comments

Comments
 (0)