Skip to content

Commit 7a7ed48

Browse files
authored
Merge pull request #2754 from kolbyjack/broadcast-custom-symbols
2 parents 01010fe + bf83341 commit 7a7ed48

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ _This release is scheduled to be released on 2022-01-01._
4444
- Fixed Calendar recurring cross timezone error (add/subtract a day, not just offset hours) (#2632)
4545
- Fixed Calendar showEnd and Full Date overlay (#2629)
4646
- Fixed regression on #2632, #2752
47+
- Broadcast custom symbols in CALENDAR_EVENTS
4748

4849
## [2.17.1] - 2021-10-01
4950

modules/default/calendar/calendar.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,6 @@ Module.register("calendar", {
237237
symbolWrapper.className = "symbol align-right " + symbolClass;
238238

239239
const symbols = this.symbolsForEvent(event);
240-
// If symbols are displayed and custom symbol is set, replace event symbol
241-
if (this.config.displaySymbol && this.config.customEvents.length > 0) {
242-
for (let ev in this.config.customEvents) {
243-
if (typeof this.config.customEvents[ev].symbol !== "undefined" && this.config.customEvents[ev].symbol !== "") {
244-
let needle = new RegExp(this.config.customEvents[ev].keyword, "gi");
245-
if (needle.test(event.title)) {
246-
symbols[0] = this.config.customEvents[ev].symbol;
247-
break;
248-
}
249-
}
250-
}
251-
}
252240
symbols.forEach((s, index) => {
253241
const symbol = document.createElement("span");
254242
symbol.className = "fa fa-fw fa-" + s;
@@ -640,6 +628,17 @@ Module.register("calendar", {
640628
symbols = this.mergeUnique(this.getCalendarPropertyAsArray(event.url, "fullDaySymbol", this.config.defaultSymbol), symbols);
641629
}
642630

631+
// If custom symbol is set, replace event symbol
632+
for (let ev of this.config.customEvents) {
633+
if (typeof ev.symbol !== "undefined" && ev.symbol !== "") {
634+
let needle = new RegExp(ev.keyword, "gi");
635+
if (needle.test(event.title)) {
636+
symbols[0] = ev.symbol;
637+
break;
638+
}
639+
}
640+
}
641+
643642
return symbols;
644643
},
645644

0 commit comments

Comments
 (0)