Skip to content

Commit c9b0ef0

Browse files
committed
fix(highlight-and-scroll): open outdated and replace editing time on old GHE
1 parent 39ef5fb commit c9b0ef0

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎src/Electron/Component/WebViewComponentInjection/highlight-and-scroll.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
}
4848

4949
async function replaceEditedTime() {
50-
const editHistories = Array.from(document.querySelectorAll('.js-comment-edit-history-menu')).map(el => el.parentElement);
50+
const editHistories = Array.from(document.querySelectorAll('.js-comment-edit-history > details'));
5151
for (const editHistory of editHistories) {
5252
editHistory.setAttribute('open', 'true');
5353
// @ts-ignore
@@ -67,7 +67,7 @@
6767

6868
// replace
6969
for (const comment of getComments()) {
70-
const editedTimeEl = comment.querySelector('.js-comment-edit-history-menu relative-time');
70+
const editedTimeEl = comment.querySelector('.js-comment-edit-history > details details-menu relative-time');
7171
if (editedTimeEl) {
7272
const editedTime = new Date(editedTimeEl.getAttribute('datetime'));
7373
const timeEl = comment.querySelector('relative-time');
@@ -88,6 +88,14 @@
8888
document.querySelectorAll('.js-resolvable-timeline-thread-container[data-resolved="true"]:not(.has-inline-notes)')
8989
);
9090

91+
// GHE(2.19.5)ではoutdatedはresolvedされてなくても閉じられてしまうので、resolvedと同じようにopenする
92+
{
93+
const outdatedContainers = Array.from(
94+
document.querySelectorAll('.js-resolvable-timeline-thread-container:not(.has-inline-notes)')
95+
).filter(el => el.querySelector('.js-toggle-outdated-comments'));
96+
containers.push(...outdatedContainers);
97+
}
98+
9199
if (containers.length) {
92100
// outdatedしている箇所を一度openして、中身を読み込ませる
93101
for (const container of containers) {

0 commit comments

Comments
 (0)