Closed Bug 1979477 Opened 1 year ago Closed 1 year ago

Implement "New" badge logic for the visual search/Google Lens context menu item

Categories

(Firefox :: Search, task, P1)

task

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: adw, Assigned: adw)

References

Details

(Whiteboard: [sng])

Attachments

(1 file)

Implement the "New" badge logic for the visual search context menu item.

Depends on: 1979962

This adds a helper to nsContextMenu that shows or hides the "New" badge for a
given menuitem, so we can use it for any item in the content context menu.

As with the Perplexity badge in D253104, I don't see a way around having to
manually fetch the "New" l10n string from Fluent. It would be nice to be able to
use a string with the .badge attribute instead, but there's no way to do that
without duplicating the main menuitem string ("Search Image") so that there's a
version with the attribute and a version without the attribute. And that doesn't
scale anyway. It would be nice if there were a way to merge Fluent strings so
you could add attributes from one string to another.

I added nsISearchEngine.isNewEngineOrURL(), which can take an optional URL
arg, analogous to how the recently added displayNameForURL() can take an
optional URL. "isNewEngineOrURL" is more awkward as a name though. It might make
sense to split it into two functions, isNewEngine() and isNewURL().

This does not update search-config-v2-schema.json because I'm planning to do
that when I vendor the related app-services change.

Depends on D258655

Pushed by dwillcoxon@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/6329beee2d91 https://hg.mozilla.org/integration/autoland/rev/0ea34722a54a Implement "New" badge logic for the visual search/Google Lens context menu item. r=Standard8,fluent-reviewers,urlbar-reviewers,bolsson
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch
QA Whiteboard: [search] [qa-triage-done-c143/b142]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: