Closed Bug 1669710 Opened 5 years ago Closed 5 years ago

Rename (preview, nonPreview) searchMode to (preview, confirmed)

Categories

(Firefox :: Address Bar, task, P3)

task
Points:
1

Tracking

()

RESOLVED FIXED
84 Branch
Iteration:
84.1 - Oct 19 - Nov 01
Tracking Status
firefox84 --- fixed

People

(Reporter: mak, Assigned: bugzilla)

References

Details

Attachments

(1 file)

I think using temporary and permanent for searchMode, instead of preview and nonPreview, would make the code more understandable.

I do think there's room for improvement with nonPreview at least. temporary and permanent make sense from one point of view, but they could also be misleading since permanent might imply that search mode could never be exited once entered. Maybe I'm overthinking it though. I would be OK with them.

Personally I do like preview since it captures the idea of not yet entering search mode but showing you what it looks like. The problem is that it doesn't have a clear opposite in this context, at least not one I can think of. I used the terms "full search mode" and "actual search mode" while reviewing the patch where Harry added preview mode, so maybe full?

I was also thinking confirmed or settled, but yes when speaking we always referred to it as full, that why it's not exactly representing the user action, it's easy to grasp.

Points: --- → 1

I agree with Drew that preview is an accurate description. I also like confirm(ed) since we can use it both as a verb and as an adjective. That makes the most sense with the way we've been writing comments. For example, we have this comment:

// Search modes are per browser and are stored in this map.  For a 
// browser, search mode can be in preview mode, non-preview mode, or both.
// Typically, search mode is entered in preview mode with a particular
// source and is promoted to non-preview mode with the same source once a
// query starts.  It's also possible for a non-preview mode to be replaced
// with a preview mode with a different source, and in those cases, we need
// to be able to restore the non-preview mode when preview mode is exited.
// In addition, only non-preview mode should be restored across sessions.
// We therefore need to keep track of both the current non-preview and
// preview modes, per browser.

Using preview and confirmed flows well:

// Search modes are per browser and are stored in this map.  For a 
// browser, search mode can be in preview mode, confirmed, or both.
// Typically, search mode is entered in preview mode with a particular
// source and is confirmed with the same source once a
// query starts.  It's also possible for a confirmed search mode to be replaced
// with a preview mode with a different source, and in those cases, we need
// to re-confirm search mode when preview mode is exited.
// In addition, only confirmed search modes should be restored across sessions.
// We therefore need to keep track of both the current confirmed and
// preview modes, per browser.

It also works if we instead replace all the references to non-preview mode with full mode, but that's a bit clunky IMO. Thoughts?

Assignee: nobody → htwyford
Status: NEW → ASSIGNED
Iteration: --- → 84.1 - Oct 19 - Nov 01

Sounds good! [Edit: confirmed, to be clear]

ship it!

Summary: Rename (preview, nonPreview) searchMode to (temporary, permanent) → Rename (preview, nonPreview) searchMode to (preview, confirmed)

There are a couple of small code changes in this patch, so here's a try run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3b210a2b465a4454e3658c89751fd5a510d0c3e2

Pushed by htwyford@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/45d432067093 Rename (preview, nonPreview) searchMode to (preview, confirmed). r=adw
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: