Closed Bug 1059087 Opened 10 years ago Closed 10 years ago

[Contacts] No space between 'Carrier Name' and 'Label'

Categories

(Firefox OS Graveyard :: Gaia::Contacts, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:2.1+, b2g-v2.0 unaffected, b2g-v2.1 verified, b2g-v2.2 verified)

VERIFIED FIXED
2.1 S4 (12sep)
blocking-b2g 2.1+
Tracking Status
b2g-v2.0 --- unaffected
b2g-v2.1 --- verified
b2g-v2.2 --- verified

People

(Reporter: ericcc, Assigned: drs)

References

Details

(Keywords: regression, Whiteboard: [planned-sprint])

Attachments

(4 files)

Attached image ContactsCarrierName.png
### STR
1. Have a contact with a phone number and carrier name.
2. View in detail view.

### Actual
No space between 'Carrier Name' and 'Label'

### Expected
With some space

### Version
Gaia      ea93363a8c424d65a9ad91438ce6961377a20f98
Gecko     https://hg.mozilla.org/mozilla-central/rev/f9bfe115fee5
BuildID   20140826160204
Version   34.0a1
ro.build.version.incremental=110
ro.build.date=Fri Jun 27 15:57:58 CST 2014
B1TC00011230
[Blocking Requested - why for this release]: Regression
blocking-b2g: --- → 2.1?
QA Whiteboard: [COM=Gaia::Contacts]
Keywords: regression
Attached image CallInformation.png
Also found in Call Information.
Probably a regression of the work we did for sharing the way to display contact information
Depends on: 1054995
Target Milestone: --- → 2.1 S4 (12sep)
Whiteboard: [planned-sprint]
Assignee: nobody → drs+bugzilla
triage: identifiable regression
blocking-b2g: 2.1? → 2.1+
Moving this to Dialer because it's our responsibility. (and it also manifests in Call Info)
Component: Gaia::Contacts → Gaia::Dialer
For reference, the purpose of components is not for tracking who is doing what, but for tracking the component the work is being done on. If someone encountered this bug, they would likely file it against contacts. Also, the regressing bug is against contacts. For these reasons, even though it manifests in the call info page, I'm moving it back to contacts.

I think this is being caused by the following very fragile code:
https://github.com/mozilla-b2g/gaia/blob/master/shared/js/contacts/contacts_buttons.js#L118

Here, we set the data-l10n-id to 'mobile', but then once it's translated, we append the 'separator' string, which in US English is ', ', to it. The obvious problem with this is that if the locale changes or l10n retranslates this for any reason, the separator/comma will be gone.

So this was always a problem (or at least since v2.0), but now it's more of a problem since we're directly calling translateFragment() on the contacts buttons containers where we didn't used to. I'm not sure what the best way is to fix this, so I'll talk with Stas and/or Zibi and then report back.
Status: NEW → ASSIGNED
Component: Gaia::Dialer → Gaia::Contacts
So, I'd suggest splitting this into three <span/>'s within <h2/>:
 - type
 - separator
 - carrier

Separator and carrier would be hidden by default.

If type has l10nId, set it on type, otherwise remove data-l10n-id and set textContent.
If carrier exists, unhide separator and carrier and set carrier's textContent to carrier.

Flod - does it sound like a good solution? RTL should switch, and I don't think we need to allow localizers to mingle with the order of those two by themselves, right?
Flags: needinfo?(francesco.lodolo)
Sounds like a good solution.

My doubt is if we actually need a separator. Can't we just have a distinct <span> for carrier, spaced from the existing element with padding/margin? What are the possible variants of this text?

P.S. still on vacation with spotty hotel's wi-fi, replies might take a while.
Flags: needinfo?(francesco.lodolo)
(In reply to Francesco Lodolo [:flod] (offline from Aug 31 to Sep 7) from comment #8)
> My doubt is if we actually need a separator. Can't we just have a distinct
> <span> for carrier, spaced from the existing element with padding/margin?
> What are the possible variants of this text?

The separator contains a comma.
PR: https://github.com/mozilla-b2g/gaia/pull/23742

This fixes the problem properly, as described in comment 7 and comment 8.
Attachment #8484534 - Flags: review?(francisco)
I still don't understand this condition: https://github.com/mozilla-b2g/gaia/blob/6c844de438a58dbf7368e7a3ce0af1effcb21e7b/shared/js/contacts/contacts_buttons.js#L109-L114 - it seems to me like the code will only be fired if escapedType is falsy, in which case it will always get to this.DEFAULT_TEL_TYPE in mozL10n.get

What am I missing here?
(In reply to Doug Sherk (:drs) from comment #9)
> The separator contains a comma.

That's exactly what I asked: do we need it or is it enough to have visual space between items, since they're already styled differently?
(In reply to Zibi Braniecki [:gandalf] from comment #11)
> I still don't understand this condition:
> https://github.com/mozilla-b2g/gaia/blob/
> 6c844de438a58dbf7368e7a3ce0af1effcb21e7b/shared/js/contacts/contacts_buttons.
> js#L109-L114 - it seems to me like the code will only be fired if
> escapedType is falsy, in which case it will always get to
> this.DEFAULT_TEL_TYPE in mozL10n.get
> 
> What am I missing here?

I think PHONE_MAP_TYPE is some kind of backwards compatibility shim. I'm not sure why |escapedType| is one of the possibilities in this branch, so I think I could remove that in this patch.

As for entering the branch to begin with, users can set custom types, so escapedType won't be falsy then.

(In reply to Francesco Lodolo [:flod] (offline from Aug 31 to Sep 7) from comment #12)
> (In reply to Doug Sherk (:drs) from comment #9)
> > The separator contains a comma.
> 
> That's exactly what I asked: do we need it or is it enough to have visual
> space between items, since they're already styled differently?

I'm inclined to leave it, but we can ask for VD input.
Flags: needinfo?(fshih)
(In reply to Doug Sherk (:drs) from comment #13)
> As for entering the branch to begin with, users can set custom types, so
> escapedType won't be falsy then.

That's exactly my concern. If the user will set custom Type then escapedType will be truthy, so the !escapedType will be falsy, so the branch will never be launched!

So it seems to me that the only scenario in which it will be launched is if escapedType is falsy, in which case it can be reduced to:

if (!escapedType) {
  escapedType = navigator.mozL10n.get(this.DEFAULT_TEL_TYPE);
}

and from there it's easy to just assign data-l10n-id instead :)
> > That's exactly what I asked: do we need it or is it enough to have visual
> > space between items, since they're already styled differently?
> 
> I'm inclined to leave it, but we can ask for VD input.
 
Yes, For the consistence with other carrier separator, we should stay with the comma. Thanks!
Flags: needinfo?(fshih)
Comment on attachment 8484534 [details] [diff] [review]
Fix missing spacing between "Carrier Name" and "Type Label".

Thanks Doug!
Attachment #8484534 - Flags: review?(francisco) → review+
(In reply to Zibi Braniecki [:gandalf] from comment #14)
> That's exactly my concern. If the user will set custom Type then escapedType
> will be truthy, so the !escapedType will be falsy, so the branch will never
> be launched!
> 
> So it seems to me that the only scenario in which it will be launched is if
> escapedType is falsy, in which case it can be reduced to:
> 
> if (!escapedType) {
>   escapedType = navigator.mozL10n.get(this.DEFAULT_TEL_TYPE);
> }
> 
> and from there it's easy to just assign data-l10n-id instead :)

I wrote a followup patch for this. Should be a quick review. It's also on the PR now.
Attachment #8487356 - Flags: review?(francisco)
Comment on attachment 8487356 [details] [diff] [review]
Remove unnecessary mozL10n.get() calls.

Tried on the PR and working like charm.

Great work Doug!
Attachment #8487356 - Flags: review?(francisco) → review+
https://github.com/mozilla-b2g/gaia/commit/14709c76da02d7353f52cce8dafee9d08a6afc18
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
See Also: → 1030346
Depends on: 1030346
See Also: 1030346
This isn't fixed on v2.1 yet. Correcting the flags to reflect that. Please request approval when you get a chance, though.
Comment on attachment 8484534 [details] [diff] [review]
Fix missing spacing between "Carrier Name" and "Type Label".

[Approval Request Comment]
[Bug caused by] (feature/regressing bug #): bug 1054995
[User impact] if declined: The phone type (e.g. "Mobile", "Work") and carrier name on the call info and contact pages will be mashed together, which is aesthetically unpleasing.
[Testing completed]: Francisco and I tried this.
[Risk to taking this patch] (and alternatives if risky): Low. Currently depends on bug 1030346, but a branch patch can be made which doesn't.
[String changes made]: None.
Attachment #8484534 - Flags: approval-gaia-v2.1?(release-mgmt)
Attachment #8484534 - Flags: approval-gaia-v2.1?(release-mgmt) → approval-gaia-v2.1+
Needs rebasing for v2.1 uplift.
Flags: needinfo?(drs+bugzilla)
Gaia-Rev        b542080231bb9cdbdb282ab926965ad3f91f7460
Gecko-Rev       https://hg.mozilla.org/releases/mozilla-aurora/rev/d614ae398c03
Build-ID        20140923155123
Version         34.0a2
Device-Name     flame
FW-Release      4.4.2
FW-Incremental  27
FW-Date         Thu Sep  4 14:59:02 CST 2014
Bootloader      L1TC10011800
Status: RESOLVED → VERIFIED
This bug is verified fixed on the Flame 2.1 (319mb) and the Flame 2.2 (319mb)


Flame 2.2 Master KK (319mb) (Full Flash)

Device: Flame 2.2 Master
BuildID: 20141011040204
Gaia: 95f580a1522ffd0f09302372b78200dab9b6f322
Gecko: 3f6a51950eb5
Gonk: 52c909e821d107d414f851e267dedcd7aae2cebf
Version: 35.0a1 (2.2 Master)
Firmware: V180
User Agent: Mozilla/5.0 (Mobile; rv:35.0) Gecko/35.0 Firefox/35.0

Flame 2.1 KK (319mb) (Full Flash)

Device: Flame 2.1
BuildID: 20141011000201
Gaia: f5d4ff60ffed8961f7d0380ada9d0facfdfd56b1
Gecko: d813d79d3eae
Gonk: 52c909e821d107d414f851e267dedcd7aae2cebf
Version: 34.0a2 (2.1)
Firmware: V180
User Agent: Mozilla/5.0 (Mobile; rv:34.0) Gecko/34.0 Firefox/34.0


Result: There is space between 'Carrier Name' and 'Label'
QA Whiteboard: [COM=Gaia::Contacts] → [QAnalyst-Triage?] [COM=Gaia::Contacts]
Flags: needinfo?(ktucker)
QA Whiteboard: [QAnalyst-Triage?] [COM=Gaia::Contacts] → [QAnalyst-Triage+] [COM=Gaia::Contacts]
Flags: needinfo?(ktucker)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: