@@ -169,9 +169,7 @@ Module.register("calendar", {
169169
170170 notificationReceived ( notification , payload , sender ) {
171171 if ( notification === "FETCH_CALENDAR" ) {
172- if ( this . hasCalendarURL ( payload . url ) ) {
173- this . sendSocketNotification ( notification , { url : payload . url , id : this . identifier } ) ;
174- }
172+ this . sendSocketNotification ( notification , { url : payload . url , id : this . identifier } ) ;
175173 }
176174 } ,
177175
@@ -183,40 +181,38 @@ Module.register("calendar", {
183181 }
184182
185183 if ( notification === "CALENDAR_EVENTS" ) {
186- if ( this . hasCalendarURL ( payload . url ) ) {
187- // have we received events for this url
188- if ( ! this . calendarData [ payload . url ] ) {
189- // no, setup the structure to hold the info
190- this . calendarData [ payload . url ] = { events : null , checksum : null } ;
191- }
192- // save the event list
193- this . calendarData [ payload . url ] . events = payload . events ;
194-
195- this . error = null ;
196- this . loaded = true ;
184+ // have we received events for this url
185+ if ( ! this . calendarData [ payload . url ] ) {
186+ // no, setup the structure to hold the info
187+ this . calendarData [ payload . url ] = { events : null , checksum : null } ;
188+ }
189+ // save the event list
190+ this . calendarData [ payload . url ] . events = payload . events ;
197191
198- if ( this . config . broadcastEvents ) {
199- this . broadcastEvents ( ) ;
200- }
201- // if the checksum is the same
202- if ( this . calendarData [ payload . url ] . checksum === payload . checksum ) {
203- // then don't update the UI
204- return ;
205- }
206- // haven't seen or the checksum is different
207- this . calendarData [ payload . url ] . checksum = payload . checksum ;
192+ this . error = null ;
193+ this . loaded = true ;
208194
209- if ( ! this . config . updateOnFetch ) {
210- if ( this . calendarDisplayer [ payload . url ] === undefined ) {
211- // calendar will never displayed, so display it
212- this . updateDom ( this . config . animationSpeed ) ;
213- // set this calendar as displayed
214- this . calendarDisplayer [ payload . url ] = true ;
215- } else {
216- Log . debug ( "[calendar] DOM not updated waiting self update()" ) ;
217- }
218- return ;
195+ if ( this . config . broadcastEvents ) {
196+ this . broadcastEvents ( ) ;
197+ }
198+ // if the checksum is the same
199+ if ( this . calendarData [ payload . url ] . checksum === payload . checksum ) {
200+ // then don't update the UI
201+ return ;
202+ }
203+ // haven't seen or the checksum is different
204+ this . calendarData [ payload . url ] . checksum = payload . checksum ;
205+
206+ if ( ! this . config . updateOnFetch ) {
207+ if ( this . calendarDisplayer [ payload . url ] === undefined ) {
208+ // calendar will never displayed, so display it
209+ this . updateDom ( this . config . animationSpeed ) ;
210+ // set this calendar as displayed
211+ this . calendarDisplayer [ payload . url ] = true ;
212+ } else {
213+ Log . debug ( "[calendar] DOM not updated waiting self update()" ) ;
219214 }
215+ return ;
220216 }
221217 } else if ( notification === "CALENDAR_ERROR" ) {
222218 let error_message = this . translate ( payload . error_type ) ;
@@ -580,21 +576,6 @@ Module.register("calendar", {
580576 return wrapper ;
581577 } ,
582578
583- /**
584- * Checks if this config contains the calendar url.
585- * @param {string } url The calendar url
586- * @returns {boolean } True if the calendar config contains the url, False otherwise
587- */
588- hasCalendarURL ( url ) {
589- for ( const calendar of this . config . calendars ) {
590- if ( calendar . url === url ) {
591- return true ;
592- }
593- }
594-
595- return false ;
596- } ,
597-
598579 /**
599580 * converts the given timestamp to a moment with a timezone
600581 * @param {number } timestamp timestamp from an event
0 commit comments