[gnome-shell] calendar: Simplify code a bit
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] calendar: Simplify code a bit
- Date: Fri, 12 Jul 2019 19:00:44 +0000 (UTC)
commit 2ff7a78b5693973f28b66c31d78b919d56c06650
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jul 12 05:25:54 2019 +0200
calendar: Simplify code a bit
Just make the error case the same as the no-appointments one.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/626
js/ui/calendar.js | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 01a56baee..f1a102505 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -237,20 +237,18 @@ var DBusEventSource = class DBusEventSource {
_onEventsReceived(results, error) {
let newEvents = [];
- let appointments = results[0] || null;
- if (appointments != null) {
- for (let n = 0; n < appointments.length; n++) {
- let a = appointments[n];
- let date = new Date(a[4] * 1000);
- let end = new Date(a[5] * 1000);
- let id = a[0];
- let summary = a[1];
- let allDay = a[3];
- let event = new CalendarEvent(id, date, end, summary, allDay);
- newEvents.push(event);
- }
- newEvents.sort((ev1, ev2) => ev1.date.getTime() - ev2.date.getTime());
+ let appointments = results[0] || [];
+ for (let n = 0; n < appointments.length; n++) {
+ let a = appointments[n];
+ let date = new Date(a[4] * 1000);
+ let end = new Date(a[5] * 1000);
+ let id = a[0];
+ let summary = a[1];
+ let allDay = a[3];
+ let event = new CalendarEvent(id, date, end, summary, allDay);
+ newEvents.push(event);
}
+ newEvents.sort((ev1, ev2) => ev1.date.getTime() - ev2.date.getTime());
this._events = newEvents;
this.isLoading = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]