Closed Bug 1583481 Opened 5 years ago Closed 5 years ago

remove unnecessary observes= from calendar

Categories

(Calendar :: General, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 71.0

People

(Reporter: mkmelin, Assigned: mkmelin)

Details

Attachments

(1 file, 3 obsolete files)

I was looking at observes attribute usage in calendar, and noticed there's apparently been some misunderstanding of how that should be used: if you have a command on the element, you don't need to have observes= too. When command updating happens, that will also take care of enabling/disabling the element.

Attached patch bug1583481_cal_observes_attr_cleanup.patch (obsolete) — — Splinter Review
Attachment #9094868 - Flags: review?(philipp)
Comment on attachment 9094868 [details] [diff] [review]
bug1583481_cal_observes_attr_cleanup.patch

Review of attachment 9094868 [details] [diff] [review]:
-----------------------------------------------------------------

Codewise this seems fine to me. One thing to consider: using `observes="foo"` when `foo` is a broadcaster would make that element an observer, which means it will watch some additional attributes, I believe including `disabled`. It doesn't seem we have any more broadcasters, but what you should make sure before pushing this is that the elements that had `observes=` aren't expecting additional attributes.
Attachment #9094868 - Flags: review?(philipp) → review+

Thanks, there are only a few commands that have attributes, and looks like those work fine.

Keywords: checkin-needed

Causes Mochitest (bct) failures locally. Did your look at your own try run?

Keywords: checkin-needed

https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=470ef6c17377d599ef5d7638d27d8b6a78931d80

document.commandDispatcher.updateCommands("calendar_commands") didn't cause calendar/lightning/content/messenger-overlay-sidebar.xul specific (eh..!) calendar_commands commands to get updated...

Attached patch bug1584720_search-textbox_context.patch (obsolete) — — Splinter Review

I think the calendar_commands not working as expected is a bug in Overlays.jsm.
Anyway, I also adjusted the context menu not to show disabled items when not on a calendar, but to hide them instead, like is usual practice for context menus. And dropped the manual logic to adjust the disabled states in the menu, since the command attribute will take care automatically now that it's working.

Attachment #9094868 - Attachment is obsolete: true
Attachment #9097576 - Flags: review?(philipp)
Comment on attachment 9097576 [details] [diff] [review]
bug1584720_search-textbox_context.patch

Review of attachment 9097576 [details] [diff] [review]:
-----------------------------------------------------------------

I think you meant to ask Jörg for review? This is in mail/
Attachment #9097576 - Flags: review?(philipp) → review?(jorgk)

Actually it may be the wrong patch, the bug numbers mismatch.

Flags: needinfo?(mkmelin+mozilla)
Comment on attachment 9097576 [details] [diff] [review]
bug1584720_search-textbox_context.patch

I've already reviewed this one and we landed it ;-) - Yes, wrong patch, we need the update to make the M(bct) pass, see comment #5.
Attachment #9097576 - Attachment is obsolete: true
Attachment #9097576 - Flags: review?(jorgk)
Attached patch bug1583481_cal_observes_attr_cleanup.patch (obsolete) — — Splinter Review

The right patch, fixed and unbitrotted.

Flags: needinfo?(mkmelin+mozilla)
Attachment #9099390 - Flags: review?(philipp)
Comment on attachment 9099390 [details] [diff] [review]
bug1583481_cal_observes_attr_cleanup.patch

Review of attachment 9099390 [details] [diff] [review]:
-----------------------------------------------------------------

::: calendar/base/content/calendar-management.js
@@ +503,4 @@
>      setupDeleteMenuitem("list-calendars-context-delete", calendar);
> +    event.target.querySelectorAll(".needs-calendar").forEach(elem => {
> +      elem.removeAttribute("collapsed");
> +    });

Same as next comment

@@ +507,2 @@
>    } else {
> +    event.target.querySelectorAll(".needs-calendar").forEach(elem => {

Can we just use for..of here? Given we are using an anonymous function anyway I think we can skip the extra function calls.
Attachment #9099390 - Flags: review?(philipp) → review+

Made the change. Didn't realize for...of works for querySelectorAll.

Attachment #9099390 - Attachment is obsolete: true
Attachment #9099717 - Flags: review+
Keywords: checkin-needed

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/e544df90a3f3
remove unnecessary observes= from calendar. r=Fallen

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

Attachment

General

Created:
Updated:
Size: