Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: Allow upcoming events to display on all categories (#37930)

Bannon Tannerd9e6d031401c
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/upcoming-events-list.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/upcoming-events-list.gjs
index 5755d31c88b..96c1f2ed699 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/upcoming-events-list.gjs
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/upcoming-events-list.gjs
@@ -7,6 +7,7 @@ import ConditionalLoadingSpinner from "discourse/components/conditional-loading-
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
import { ajax } from "discourse/lib/ajax";
+import { applyValueTransformer } from "discourse/lib/transformer";
import { or } from "discourse/truth-helpers";
import { i18n } from "discourse-i18n";
import { isNotFullDayEvent } from "../lib/guess-best-date-format";
@@ -88,6 +89,13 @@ export default class UpcomingEventsList extends Component {
}
}
+ get shouldShowCrossCategory() {
+ return applyValueTransformer(
+ "discourse-calendar-upcoming-events-show-cross-category",
+ false // default value
+ );
+ }
+
@action
async updateEventsList() {
this.isLoading = true;
@@ -103,7 +111,7 @@ export default class UpcomingEventsList extends Component {
data.include_subcategories = true;
}
- if (this.categoryId) {
+ if (this.categoryId && !this.shouldShowCrossCategory) {
data.category_id = this.categoryId;
}
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/pre-initializers/transformers.js b/plugins/discourse-calendar/assets/javascripts/discourse/pre-initializers/transformers.js
index 4af83e77ee6..d2d06cf37bf 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/pre-initializers/transformers.js
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/pre-initializers/transformers.js
@@ -7,6 +7,9 @@ export default {
api.addValueTransformerName(
"discourse-calendar-event-more-menu-should-show-participants"
);
+ api.addValueTransformerName(
+ "discourse-calendar-upcoming-events-show-cross-category"
+ );
});
},
};