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

fix: When using search-config-v2 make the order of engines behave the same as desktop (bug 1895740) #168

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Standard8
Copy link
Collaborator

This adds search order handling to be the same as desktop. It is possible that we could move desktop's sort function to a function that we could call from the extension as well - but we would still need a fallback (at least in the short term) for the current versions of FF, and overall, I'm not sure if it is worth it as it isn't something we generally update.

@Standard8 Standard8 requested a review from mandysGit May 8, 2024 16:05
Comment on lines +185 to +187
if (a == defaultEngine) {
return -1;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest adding the same comment as the Desktop code:

The app default engine should always be first in the list (except
for distros, that we should respect).

Comment on lines +188 to +195
if (privateDefault) {
if (a == privateDefault && b == defaultEngine) {
return -1;
}
if (a == defaultEngine && b == privateDefault) {
return 1;
}
}
Copy link
Collaborator

@mandysGit mandysGit May 16, 2024

Choose a reason for hiding this comment

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

This doesn't look equivalent to the desktop version.
How are we checking that privateDefault is not the same as the defaultEngine here?

I suggest to add the same comment as desktop here:

if there's a private default, and it is different to the normal
default, then it should be second in the list.

mandysGit

This comment was marked as duplicate.

@mandysGit mandysGit self-requested a review May 16, 2024 03:06
Copy link
Collaborator

@mandysGit mandysGit left a comment

Choose a reason for hiding this comment

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

I added comments for review.

return 1;
}
}
if (a._orderHint && b._orderHint) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might as well add this comment too?

We sort by highest orderHint first, then alphabetically by name.

@mandysGit
Copy link
Collaborator

mandysGit commented May 21, 2024

Hi @Standard8 ,
Sorry I forgot to write an update here after our meeting last week.

IIRC, you're investigating on how to make _sortEnginesByDefaults public so we can call it from search engine dev tools; rather than re-writing an equivalent sort function in this repo.

Should we close out this PR then?

@Standard8
Copy link
Collaborator Author

I'll update the desktop code & this PR together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants