Skip to content

Conversation

@PauloCarneiro99
Copy link
Contributor

@yakov116

This comment has been minimized.

commentsToHide.push(comment); // Add all similar comments to be hidden
}

similarCommentBtn.click(); // Expand all the similar comments on this box
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done only when the user expands the comments

const similarCommentBoxes = select.all('.Details-element');

for (const similarCommentsBox of similarCommentBoxes) {
const similarCommentBtn: HTMLElement = similarCommentsBox.querySelectorAll('.Details-content--closed')[0] as HTMLElement;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

select() can take a root element for the query as the second argument:

Suggested change
const similarCommentBtn: HTMLElement = similarCommentsBox.querySelectorAll('.Details-content--closed')[0] as HTMLElement;
const similarCommentBtn = select('.Details-content--closed', similarCommentsBox);

Same for the next line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several querySelectors while there should only be one at the top (and only one loop). Once my other comment is applied, this should become clearer

@fregante fregante marked this pull request as draft December 27, 2020 09:05
@fregante
Copy link
Member

#3827 was merged, this can now continue

@fregante
Copy link
Member

Closing this for now, but please continue if you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Expand but hide "1 similar comment" in hide-useless-comments

4 participants