Closed Bug 1639763 Opened 4 years ago Closed 4 years ago

Rewrite the attendees dialog using modern code

Categories

(Calendar :: Dialogs, enhancement)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 78.0

People

(Reporter: darktrojan, Assigned: darktrojan)

References

Details

Attachments

(1 file, 1 obsolete file)

This is something I have been chipping away at for some months now. It's not complete, but it is good enough to ship with 78, and it is better than the existing dialog. So I intend to land the patch to get it in front of Daily users, then fix as many of the remaining problems as possible (in follow-up bugs) before 78 ships.

I'm not trying to reinvent the wheel here, just replace it with a new wheel that rolls a bit more smoothly. There are some fundamental issues with the dialog (not least that it doesn't actually do a lot at present) that will still exist after this bug lands, but it should be much easier to maintain and test, as well as nicer to use.

Attached patch 1639763-attendees-dialog-1.diff (obsolete) (deleted) — Splinter Review

Okay, I could keep making changes to this until the cows come home. And quite frankly, I'm sick of looking at it, so here it is.

Things I know I still have to do:

  • There's a problem with dragging the bar to a point where the grid scrolls.
  • I'm not showing the status icon for each attendee. This very rarely showed up in the old version and I don't know if it's actually worth having.
  • Way more of this could be tested. At least I have a good starting point for easily making new tests now.
  • Deal with the stylesheets. I added a new one just for this dialog to keep it tidy, but a lot of the styling is still in the sheet which gets shared across all of the event dialogs. I always thought this was a bit odd.
  • Fine-tune what happens with keyboard navigation. I hope we can get a variation of the compose pills happening at some point.
  • Probably a bunch of other things I can't think of right now.
Attachment #9150656 - Flags: review?(paul)
Comment on attachment 9150656 [details] [diff] [review] 1639763-attendees-dialog-1.diff Review of attachment 9150656 [details] [diff] [review]: ----------------------------------------------------------------- Wow, so glad to see this getting a rewrite! Thanks for working on it. It would be ready for r+ but I got failures when I ran the test locally (see below). I also ran into an error when using a calendar without an email address set for it. (That may already exist?) The header sections for the days and times don't seem to align with the grid lines below it. (The lines between the days in the header fall in between the grid column lines.) Other than that just a few minor comments, questions, and nits. Edit: I updated my m-c and got some different test failures (which I've updated here): Unexpected Results ------------------ comm/calendar/test/browser/eventDialog/browser_attendeesDialog.js FAIL 0 == 6 - JS frame :: chrome://mochitests/content/browser/comm/calendar/test/browser/eventDialog/browser_attendeesDialog.js :: checkAttendeeCells :: line 180 Stack trace: chrome://mochitests/content/browser/comm/calendar/test/browser/eventDialog/browser_attendeesDialog.js:checkAttendeeCells:180 chrome://mochitests/content/browser/comm/calendar/test/browser/eventDialog/browser_attendeesDialog.js:null:186 chrome://mochikit/content/browser-test.js:Tester_execTest/<:1064 chrome://mochikit/content/browser-test.js:Tester_execTest:1104 chrome://mochikit/content/browser-test.js:nextTest/<:927 chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/waitForFocusInner/focusedOrLoaded/<:918 FAIL Uncaught exception - at chrome://mochitests/content/browser/comm/calendar/test/browser/eventDialog/browser_attendeesDialog.js:182 - TypeError: can't access property "getAttribute", cells[i] is undefined Stack trace: checkAttendeeCells@chrome://mochitests/content/browser/comm/calendar/test/browser/eventDialog/browser_attendeesDialog.js:182:7 @chrome://mochitests/content/browser/comm/calendar/test/browser/eventDialog/browser_attendeesDialog.js:186:21 Async*Tester_execTest/<@chrome://mochikit/content/browser-test.js:1064:34 Tester_execTest@chrome://mochikit/content/browser-test.js:1104:11 nextTest/<@chrome://mochikit/content/browser-test.js:927:14 SimpleTest.waitForFocus/waitForFocusInner/focusedOrLoaded/<@chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:918:23 FAIL Found an unexpected Calendar:EventDialog at the end of test run - ::: calendar/base/content/dialogs/calendar-event-dialog-attendees.js @@ +164,5 @@ > + dayHeaderOuter.scrollTo(scrollPoint, 0); > + freebusyGrid.scrollTo(scrollPoint, freebusyGrid.scrollTop); > + } > + }, > +}; You really don't like empty lines, do you? :-p @@ +190,5 @@ > + return cal.dtz.jsDateToDateTime(this.start.value, this.startZone._zone); > + }, > + set startValue(value) { > + // Set the zone first, because the change in time will trigger an update. > + this.startZone._zone = value.timezone; I try to avoid saving data on DOM elements to maintain more of a Model/View separation (as with MVC), but that doesn't seem to be your approach here. What do you think? @@ +279,2 @@ > > +addEventListener( Huh, I'm unfamiliar with `addEventListener` at the top level like this. I assume it adds the listener to the `window`. Would it make sense to do `window.addEventListener` to make that explicit? @@ +381,5 @@ > + let organizerElement = attendeeList.appendChild(document.createXULElement("event-attendee")); > + organizerElement.attendee = organizer; > + } else { > + let organizerElement = attendeeList.appendChild(document.createXULElement("event-attendee")); > + organizerElement.value = calendar.getProperty("organizerId").replace(/^mailto:/, ""); I happened to run into an error here when I used a calendar without an email address set for it. Apparently, the `calendar.getProperty("organizerId)` is null in that case. The dialog looked a bit broken in that case. @@ +457,5 @@ > } > > +// Wrap in a block to prevent leaking to window scope. > +{ > + class EventAttendee extends MozXULElement { Would be good to include docstrings for these CEs (and probably some other functions too). @@ +711,5 @@ > + EventAttendee.statusCycle = ["ACCEPTED", "DECLINED", "TENTATIVE"]; > + EventAttendee.userTypeCycle = ["INDIVIDUAL", "GROUP", "RESOURCE", "ROOM"]; > + customElements.define("event-attendee", EventAttendee); > + > + class CalendarDay extends MozXULElement { Docstring for CE.
Attachment #9150656 - Flags: review?(paul) → feedback+
Attached patch 1639763-attendees-dialog-2.diff (deleted) — Splinter Review

I fixed the test (yay bitrot) and addressed all the comments, I think.

Attachment #9150656 - Attachment is obsolete: true
Attachment #9152649 - Flags: review?(paul)
Comment on attachment 9152649 [details] [diff] [review] 1639763-attendees-dialog-2.diff Review of attachment 9152649 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for the updates. Looks good. Confirmed that the test now passes locally.
Attachment #9152649 - Flags: review?(paul) → review+
Comment on attachment 9152649 [details] [diff] [review] 1639763-attendees-dialog-2.diff I suppose we should actually ship this. :-)
Attachment #9152649 - Flags: approval-calendar-beta?(paul)
Attachment #9152649 - Flags: approval-calendar-beta?(paul) → approval-calendar-beta+

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/862c66f349d1
Rewrite the attendees dialog using modern code. r=pmorris

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 79
Target Milestone: 79 → 78
Regressions: 1645719
Regressions: 1647928
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: