Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable quick-mention on reviews without a comment #5117

Merged
merged 9 commits into from
Dec 10, 2021

Conversation

kidonng
Copy link
Member

@kidonng kidonng commented Nov 29, 2021

See screenshots for the issue

Also, as you can see from the screenshot, there is a z-index issue happening. However it should not happen again with this patch, but nevertheless I will leave the fix here for completeness:

wrap(avatar, <div className="avatar-parent-child TimelineItem-avatar d-none d-md-block"/>);

Add a style={{zIndex: 2}} would be fine

Test URLs

Screenshot

Before:
截屏2021-11-29 20 59 02

After:

image

@@ -59,6 +59,11 @@ function init(): void {
<ReplyIcon/>
</button>,
);

const timelineItem = avatar.closest('.js-timeline-item')!;
if (timelineItem && !timelineItem.querySelector('.timeline-comment')) {
Copy link
Member Author

Choose a reason for hiding this comment

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

timelineItem doesn't exist for the first "comment" (i.e. author post)

@fregante
Copy link
Member

fregante commented Nov 30, 2021

I'd just exclude reviews honestly 😅 like in

It's weird that this changes the spacing

@kidonng
Copy link
Member Author

kidonng commented Dec 2, 2021

Yeah that makes sense.

@kidonng kidonng changed the title Fix spacing of quick-mention items without a comment Disable quick-mention on reviews without a comment Dec 2, 2021
@kidonng
Copy link
Member Author

kidonng commented Dec 6, 2021

@fregante
Copy link
Member

fregante commented Dec 6, 2021

I don't see that, but I'm glad you do and can fix it 😃

Screen Shot

@kidonng
Copy link
Member Author

kidonng commented Dec 7, 2021

I don't see that

Because you don't have write access and thus that info line.

// The hovercard attribute avoids `highest-rated-comment`
// Avatars next to review events aren't wrapped in a <div> #4844
const avatars = select.all(`:is(div.TimelineItem-avatar > [data-hovercard-type="user"]:first-child, a.TimelineItem-avatar):not([href="/${getUsername()!}"], .rgh-quick-mention)`);
const avatars = select.all(`:is(${[
Copy link
Member

Choose a reason for hiding this comment

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

I'd probably extract this array instead to avoid (`:is(${[

Common is-less example:

const avatarSelector = [

].map(x => x + ':not()');
const avatars = select.all(avatarSelector);

Copy link
Member

Choose a reason for hiding this comment

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

You could also move this to the lint PR if you prefer

Copy link
Member

Choose a reason for hiding this comment

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

Latest commit did not match this, let's merge this PR without it and you can make the suggested change in the lint PR if desired.

@fregante fregante merged commit 044f1b4 into refined-github:main Dec 10, 2021
@kidonng kidonng deleted the quick-mention branch January 9, 2022 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants