dateMenu: Ignore the allDay property of an event

Given the correct end date this code would be able to determine this
correctly itself and doesn't need to rely on that property. And events
without correct end dates are currently not shown anyway. This prepares
for removing the allDay property entirely.

This also fixes events going from 13:00 the current day to 01:00 not
showing "...". It also fixes multi-day events wrongly detected as
all-day events by the calendar-server showing up as "All day", despite
only covering 1 hour of the day.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2023>
This commit is contained in:
Sebastian Keller 2021-11-04 12:48:26 +01:00 committed by Marge Bot
parent 2250653673
commit d8efce0ffd

View File

@ -170,8 +170,8 @@ class EventsSection extends St.Button {
} }
_formatEventTime(event) { _formatEventTime(event) {
const allDay = event.allDay || const allDay =
(event.date <= this._startDate && event.end >= this._endDate); event.date <= this._startDate && event.end >= this._endDate;
let title; let title;
if (allDay) { if (allDay) {
@ -185,13 +185,13 @@ class EventsSection extends St.Button {
} }
const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
if (event.date < this._startDate && !event.allDay) { if (event.date < this._startDate) {
if (rtl) if (rtl)
title = '%s%s'.format(title, ELLIPSIS_CHAR); title = '%s%s'.format(title, ELLIPSIS_CHAR);
else else
title = '%s%s'.format(ELLIPSIS_CHAR, title); title = '%s%s'.format(ELLIPSIS_CHAR, title);
} }
if (event.end > this._endDate && !event.allDay) { if (event.end > this._endDate) {
if (rtl) if (rtl)
title = '%s%s'.format(ELLIPSIS_CHAR, title); title = '%s%s'.format(ELLIPSIS_CHAR, title);
else else