-
-
Notifications
You must be signed in to change notification settings - Fork 29
Fix isOrganizationRepo
#231
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
base: main
Are you sure you want to change the base?
Conversation
4e2ea82 to
b3284c2
Compare
|
|
||
| export const isOrganizationRepo = (): boolean => exists('.AppHeader-context-full [data-hovercard-type="organization"]'); | ||
| // TODO: Remove the second check after June 2026 | ||
| export const isOrganizationRepo = (): boolean => Boolean($('qbsearch-input')?.getAttribute('data-current-org')) || exists('.AppHeader-context-full [data-hovercard-type="organization"]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the first check can also be a single selector (qbsearch-input[data-current-org]) so this can be a single exists() call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be :is(qbsearch-input[data-current-org]:not[[data-current-org]=""], .AppHeader-context-full [data-hovercard-type="organization"]). Do you prefer that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need for :is() though, right? I think I prefer it because it's more specific about what's expecting anyway, rather than the catch-all/casting Boolean()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need for :is() though, right?
Unless you want me to update exists and $ to support selector arrays, there is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you suggest to make only the first check a single exists() call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exists('a, b')
I don't see what the issue is in that screenshot. Empty attributes can also be selected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also just use exists(['a','b'].join()) to keep each line commentable. Or String([]). Or have it accept an array. I'm sure this isn't the first array of selectors in this package?
This reverts commit 6f19b57.

No description provided.