Closed Bug 1538533 Opened 6 years ago Closed 5 years ago

Invitations dialog broken - de-xbl calendar-invitations-richlistitem binding

Categories

(Calendar :: E-mail based Scheduling (iTIP/iMIP), defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: darktrojan, Assigned: arshad)

References

Details

(Keywords: regression)

Attachments

(3 files, 10 obsolete files)

(deleted), image/png
Details
(deleted), image/png
Details
(deleted), patch
mkmelin
: review+
Details | Diff | Splinter Review

The list in the invitations dialog (calendar-invitations-dialog.xul) is messed up, probably because richlist only deals with richlistitems these days and our items are calendar-invitations-richlistitems.

I would assume due to bug 1523600.

Keywords: regression
Summary: Invitations dialog broken → Invitations dialog broken - de-xbl calendar-invitations-richlistitem binding

Arshad, can you take a look

Assignee: nobody → arshdkhn1

(In reply to Geoff Lankow (:darktrojan) from comment #0)

Created attachment 9053119 [details]
Screenshot from 2019-03-24 21-36-19.png

The list in the invitations dialog (calendar-invitations-dialog.xul) is messed up, probably because richlist only deals with richlistitems these days and our items are calendar-invitations-richlistitems.

Could you please tell what should the cal-invitaiton dialog look like and what's the differnce that you see? This ll help me alot. Please post some screenshots to show that.

There is a screenshot here, the "No unconfirmed invitations" should not be at that spot (or be there at all).

Attached image invitations.png (deleted) —

Additional screenshot. The one item isn't showing for me (but there is one, as indicated in the title too)

Converting calendar-invitations-richlistitem to <richlistitem is="calendar-invitations-richlistitem"> should help.

Attached patch cal-invitation-dialog-fix.patch (obsolete) (deleted) — Splinter Review
Attachment #9061243 - Flags: review?(mkmelin+mozilla)
Status: NEW → ASSIGNED
Comment on attachment 9061243 [details] [diff] [review] cal-invitation-dialog-fix.patch Review of attachment 9061243 [details] [diff] [review]: ----------------------------------------------------------------- While this looks like the right thing to do you're not converting it to custom element here. Can you do convert it to <richlistitem is="calendar-invitations-richlistitem"> so that we do not have to test this many times.
Attachment #9061243 - Flags: review?(mkmelin+mozilla)
Attached patch calendar-invitations-richlistitem.patch (obsolete) (deleted) — Splinter Review

On pushing a try, I got -

remote: ************************** ERROR **************************** remote: try-comm-central is CLOSED! Reason: Bug 1548973 remote: To push despite the closed tree, include "CLOSED TREE" in your push comment remote: *************************************************************

Attachment #9061243 - Attachment is obsolete: true
Attachment #9062749 - Flags: review?(mkmelin+mozilla)
Attached patch calendar-invitations-richlistitem.patch (obsolete) (deleted) — Splinter Review
Attachment #9062749 - Attachment is obsolete: true
Attachment #9062749 - Flags: review?(mkmelin+mozilla)
Attachment #9062751 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9062751 [details] [diff] [review] calendar-invitations-richlistitem.patch Review of attachment 9062751 [details] [diff] [review]: ----------------------------------------------------------------- ::: calendar/base/content/dialogs/calendar-invitations-dialog.js @@ +16,5 @@ > + this.mCalendarItem = null; > + this.mInitialParticipationStatus = null; > + this.mParticipationStatus = null; > + this.mDateFormatter = cal.getDateFormatter(); > + this.mStrings = { There is no .properties file for calendar-invitations.dtd so instead of creating a new file just for this element, I instead assigned the string values directly here. @@ +218,5 @@ > let updatingBox = document.getElementById("updating-box"); > updatingBox.setAttribute("hidden", "true"); > let richListBox = document.getElementById("invitations-listbox"); > for (let item of aItems) { > + let newNode = document.createXULElement("richlistitem", { is: "calendar-invitations-richlistitem" }); this calendar-invitations richlistitem won't be having is attribute.. so I have to add a new class for css selectors
Comment on attachment 9062751 [details] [diff] [review] calendar-invitations-richlistitem.patch Review of attachment 9062751 [details] [diff] [review]: ----------------------------------------------------------------- ::: calendar/base/content/dialogs/calendar-invitations-dialog.js @@ +23,5 @@ > + location: "Location: ", > + organizer: "Organizer: ", > + attendee: "Attendee: ", > + none: "None" > + }; This is not acceptable as it wouldn't be localizable. Please move to using Fluent: https://firefox-source-docs.mozilla.org/intl/l10n/l10n/fluent_tutorial.html#markup-localization @@ +194,5 @@ > + "calendar-invitations-richlistitem", > + MozCalendarInvitationsRichlistitem, > + { "extends": "richlistitem" } > + ); > + why is this in onLoad and not directly after the class def? @@ +218,5 @@ > let updatingBox = document.getElementById("updating-box"); > updatingBox.setAttribute("hidden", "true"); > let richListBox = document.getElementById("invitations-listbox"); > for (let item of aItems) { > + let newNode = document.createXULElement("richlistitem", { is: "calendar-invitations-richlistitem" }); It won't have the "is" automatcially but it's good practice to add it in connectedCallback
Attachment #9062751 - Flags: review?(mkmelin+mozilla) → review-
Attached patch calendar-invitations-richlistitem.patch (obsolete) (deleted) — Splinter Review
Attachment #9062751 - Attachment is obsolete: true
Comment on attachment 9063133 [details] [diff] [review] calendar-invitations-richlistitem.patch Review of attachment 9063133 [details] [diff] [review]: ----------------------------------------------------------------- ::: calendar/locales/jar.mn @@ +3,5 @@ > # License, v. 2.0. If a copy of the MPL was not distributed with this > # file, You can obtain one at http://mozilla.org/MPL/2.0/. > > +[localization] calendar-@AB_CD@.jar: > + calendar (%calendar/**/*.ftl) What am I doing wrong? I am getting "No bundle resource generated error"
Attachment #9063133 - Flags: feedback?(mkmelin+mozilla)

When do you get that? mach build doesn't complain to me

Richard, You have worked with ftl file, what's going wrong here? I get Request for keys failed because no resource bundles got generated. error when I try get a value from the .ftl file.

Flags: needinfo?(richard.marti)

You need to declare the FTL file in the XUL. Something like:

<linkset>
<html:link rel="localization" href="calendar/calendarInvitationsDialog.ftl"/>
</linkset>

Maybe the path needs some tweaks. I've never used Fluent with a extension.

Flags: needinfo?(richard.marti)

Since it's done all programmatically here I don't think the link in the xul file is necessary. It works if I reference a ftl file from mail.

Something's wrong with the path though.
In jar.mn it should probably be

[localization] @AB_CD@.jar:
calendar (%calendar/**/*.ftl)

... and not calendar-@AB_CD@.jar

With that change, the calendarInvitationsDialog.ftl ends up under extensions in
{lightning-id}

  • localization
    • en-US (not calendar-en-US)
      • calendar

The thunderbird main files are under /localization.

Philipp, any ideas?

Flags: needinfo?(philipp)

Maybe something like href="moz-extension://e2fda1a4-762b-4020-b5ad-a41df1933103/localization/calendar-@AB_CD@/calendar/calendarInvitationsDialog.ftl" or href="moz-extension://e2fda1a4-762b-4020-b5ad-a41df1933103/localization/calendar-en-US/calendar/calendarInvitationsDialog.ftl" works.

If not, maybe you need to switch to properties as the merge is next week and then the localization is frozen.

Attached patch calendar-invitations-richlistitem_props.patch (obsolete) (deleted) — Splinter Review

You can use this one with the properties file if ftl file issue doesn't get fixed soon.

Attachment #9064208 - Flags: review?(mkmelin+mozilla)
Attached patch calendar-invitations-richlistitem_props.patch (obsolete) (deleted) — Splinter Review
Attachment #9064208 - Attachment is obsolete: true
Attachment #9064208 - Flags: review?(mkmelin+mozilla)
Attachment #9064210 - Flags: review?(mkmelin+mozilla)

I think it would be better if we kept Fluent out of Lightning until after 68, especially if it's just one file.

Comment on attachment 9064210 [details] [diff] [review] calendar-invitations-richlistitem_props.patch Review of attachment 9064210 [details] [diff] [review]: ----------------------------------------------------------------- ::: calendar/base/content/dialogs/calendar-invitations-dialog.js @@ +8,5 @@ > > var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm"); > +var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); > + > +const calInvitationsProps = Services.strings.createBundle("chrome://calendar/locale/calendar-invitations-dialog.properties"); Please set this up in the constructor. @@ +11,5 @@ > + > +const calInvitationsProps = Services.strings.createBundle("chrome://calendar/locale/calendar-invitations-dialog.properties"); > + > +class MozCalendarInvitationsRichlistitem extends MozElements.MozRichlistitem { > + constructor() { Please add documentation. @@ +26,5 @@ > + return calInvitationsProps.GetStringFromName(propName); > + } > + > + connectedCallback() { > + this.setAttribute("is", "calendar-invitations-richlistitem"); please move this below the hasChildNodes() check @@ +48,5 @@ > + <vbox> > + <button group="${this.getAttribute("itemId")}" > + type="radio" > + class="calendar-invitations-richlistitem-accept-button > + calendar-invitations-richlistitem-button" don't span classes over two lines please @@ +123,5 @@ > + if (locationProperty && locationProperty.length > 0) { > + locationString += locationProperty; > + } else { > + locationString += this.getString("none"); > + } all of these strings should really be moved to proper using a proper localization system, and PluralForm. Something like https://searchfox.org/comm-central/rev/a6f313573be4254edafe723456289680f12b0101/calendar/base/content/calendar-ui-utils.js#444 @@ +188,5 @@ > +customElements.define( > + "calendar-invitations-richlistitem", > + MozCalendarInvitationsRichlistitem, > + { "extends": "richlistitem" } > +); Maybe format as customElements.define( "calendar-invitations-richlistitem", MozCalendarInvitationsRichlistitem, { "extends": "richlistitem" } ); ::: calendar/locales/en-US/chrome/calendar/calendar-invitations-dialog.properties @@ +5,5 @@ > +allday-event=All day event > +recurrent-event=Repeating event > +location=Location:\u0020 > +organizer=Organizer:\u0020 > +attendee=Attendee:\u0020 You should also remove the calendar.invitations.list.alldayevent.text etc. entities from the dtd now that they wouldn't be used anymore. Encoding spaces like this is not so nice. It's just one symptom that the code is wrong: it should use proper localisation system, like I pointed at above.
Attachment #9064210 - Flags: review?(mkmelin+mozilla) → review-
Attached patch calendar-invitations-richlistitem_props.patch (obsolete) (deleted) — Splinter Review
Attachment #9064210 - Attachment is obsolete: true
Comment on attachment 9065610 [details] [diff] [review] calendar-invitations-richlistitem_props.patch Review of attachment 9065610 [details] [diff] [review]: ----------------------------------------------------------------- ::: calendar/base/content/dialogs/calendar-invitations-dialog.js @@ +119,5 @@ > + > + let locationLabel = this.querySelector(".calendar-invitations-richlistitem-location"); > + let locationString = this.getString("location"); > + let locationProperty = item.getProperty("LOCATION"); > + if (locationProperty && locationProperty.length > 0) { I dont understand why I would use Plural form here? ::: calendar/locales/en-US/chrome/calendar/calendar-invitations-dialog.properties @@ +5,5 @@ > +allday-event=All day event > +recurrent-event=Repeating event > +location=Location:\u0020 > +organizer=Organizer:\u0020 > +attendee=Attendee:\u0020 https://searchfox.org/comm-central/search?q=%5Cu0020&path=.properties there are multiple places where such encoding is used. I am not sure what is the best way. We can tackle rtl and ltl language issue using css?
Attachment #9065610 - Flags: feedback?(mkmelin+mozilla)
Attachment #9063133 - Flags: feedback?(mkmelin+mozilla)

You don't need to necessarily use pluralform. Can also use bundle.formatStringFromName.
The point was that building the final string by + is basically wrong.

Attachment #9065610 - Flags: feedback?(mkmelin+mozilla)

For where to put ftl files, calendar-ab-cd is ok. You need to possibly register the custom context, I did this some time back but can't find the code now. If it works in mail maybe check how it is registered there.

https://firefox-source-docs.mozilla.org/intl/l10n/l10n/fluent_tutorial.html

Flags: needinfo?(philipp)
Attached patch calendar-invitations-richlistitem_props.patch (obsolete) (deleted) — Splinter Review
Attachment #9063133 - Attachment is obsolete: true
Attachment #9065610 - Attachment is obsolete: true
Attachment #9065956 - Flags: review?(mkmelin+mozilla)
Attached patch calendar-invitations-richlistitem_props.patch (obsolete) (deleted) — Splinter Review
Attachment #9065956 - Attachment is obsolete: true
Attachment #9065956 - Flags: review?(mkmelin+mozilla)
Attachment #9065957 - Flags: review?(mkmelin+mozilla)
Attached patch calendar-invitations-richlistitem_props.patch (obsolete) (deleted) — Splinter Review
Attachment #9065957 - Attachment is obsolete: true
Attachment #9065957 - Flags: review?(mkmelin+mozilla)
Attachment #9065958 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9065958 [details] [diff] [review] calendar-invitations-richlistitem_props.patch Review of attachment 9065958 [details] [diff] [review]: ----------------------------------------------------------------- ::: calendar/base/content/dialogs/calendar-invitations-dialog.js @@ +118,5 @@ > + } > + > + let locationLabel = this.querySelector(".calendar-invitations-richlistitem-location"); > + let locationProperty = item.getProperty("LOCATION") || this.getString("none"); > + let locationString = this.calInvitationsProps.formatStringFromName( I hope this is ok now.
Comment on attachment 9065958 [details] [diff] [review] calendar-invitations-richlistitem_props.patch Review of attachment 9065958 [details] [diff] [review]: ----------------------------------------------------------------- Correct, but you only changed the one occurrence :(
Attachment #9065958 - Flags: review?(mkmelin+mozilla)

Formatting all the strings that need formatting.

Attachment #9065958 - Attachment is obsolete: true
Attachment #9065968 - Flags: review+

Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/ed4e2f863976
de-xbl calendar-invitations-richlistitem binding. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 7.0
Regressions: 1644081
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: