Skip to content

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

DEV: Remove dead code from the calendar plugin (#42470)

Régis Hanoldcfef4d4953e
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/modal/post-event-builder.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/modal/post-event-builder.gjs
index 28a3008fd1c..3be944739f5 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/modal/post-event-builder.gjs
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/modal/post-event-builder.gjs
@@ -407,22 +407,6 @@ export default class PostEventBuilder extends Component {
return this.args.model.event?.post?.topic?.title;
}
- get userTimezone() {
- return this.currentUser?.user_option?.timezone || moment.tz.guess();
- }
-
- get statusText() {
- const status =
- this.event.status === "standalone"
- ? "public"
- : this.event.status || "public";
- return i18n(`discourse_post_event.models.event.status.${status}.title`);
- }
-
- get eventNamePlaceholder() {
- return i18n("discourse_post_event.composer.name_placeholder");
- }
-
get compactInitialState() {
return {
...defaultEventState(),
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/controllers/discourse-post-event-upcoming-events.js b/plugins/discourse-calendar/assets/javascripts/discourse/controllers/discourse-post-event-upcoming-events.js
deleted file mode 100644
index e6c2655f749..00000000000
--- a/plugins/discourse-calendar/assets/javascripts/discourse/controllers/discourse-post-event-upcoming-events.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import Controller from "@ember/controller";
-
-export default class extends Controller {}
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/helpers/format-future-date.js b/plugins/discourse-calendar/assets/javascripts/discourse/helpers/format-future-date.js
deleted file mode 100644
index 9e78486c90d..00000000000
--- a/plugins/discourse-calendar/assets/javascripts/discourse/helpers/format-future-date.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import { trustHTML } from "@ember/template";
-import guessDateFormat from "../lib/guess-best-date-format";
-
-export default function (date) {
- date = moment.utc(date).tz(moment.tz.guess());
- const format = guessDateFormat(date);
- return trustHTML(date.format(format));
-}
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/initializers/event-relative-date.js b/plugins/discourse-calendar/assets/javascripts/discourse/initializers/event-relative-date.js
deleted file mode 100644
index 8460897d79a..00000000000
--- a/plugins/discourse-calendar/assets/javascripts/discourse/initializers/event-relative-date.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import { cancel } from "@ember/runloop";
-import { isTesting } from "discourse/lib/environment";
-import discourseLater from "discourse/lib/later";
-import eventRelativeDate from "../lib/event-relative-date";
-
-function computeRelativeEventDates() {
- document
- .querySelectorAll(".event-relative-date.topic-list")
- .forEach((dateContainer) => eventRelativeDate(dateContainer));
-}
-
-export default {
- name: "event-future-date",
-
- initialize() {
- computeRelativeEventDates();
-
- if (!isTesting()) {
- this._tick();
- }
- },
-
- teardown() {
- if (this._interval) {
- cancel(this._interval);
- this._interval = null;
- }
- },
-
- _tick() {
- this._interval && cancel(this._interval);
-
- this._interval = discourseLater(() => {
- computeRelativeEventDates();
- this._tick();
- }, 60 * 1000);
- },
-};
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/lib/event-relative-date.js b/plugins/discourse-calendar/assets/javascripts/discourse/lib/event-relative-date.js
deleted file mode 100644
index 4f9b345921a..00000000000
--- a/plugins/discourse-calendar/assets/javascripts/discourse/lib/event-relative-date.js
+++ /dev/null
@@ -1,58 +0,0 @@
-import { i18n } from "discourse-i18n";
-import guessDateFormat from "./guess-best-date-format";
-
-function _computeCurrentEvent(container, endsAt) {
- const indicator = document.createElement("div");
- indicator.classList.add("indicator");
- container.appendChild(indicator);
-
- const text = document.createElement("span");
- text.classList.add("text");
- text.innerText = i18n("discourse_post_event.topic_title.ends_in_duration", {
- duration: endsAt.from(moment()),
- });
- container.appendChild(text);
-}
-
-function _computePastEvent(container, endsAt) {
- container.innerText = endsAt.from(moment());
-}
-
-function _computeFutureEvent(container, startsAt) {
- container.innerText = startsAt.from(moment());
-}
-
-export default function eventRelativeDate(container) {
- container.classList.remove("past", "current", "future");
- container.innerHTML = "";
-
- const startsAt = moment
- .utc(container.dataset.starts_at)
- .tz(moment.tz.guess());
- const endsAt = moment.utc(container.dataset.ends_at).tz(moment.tz.guess());
-
- const format = guessDateFormat(startsAt);
- let title = startsAt.format(format);
- if (endsAt) {
- title += ` → ${endsAt.format(format)}`;
- }
- container.setAttribute("title", title);
-
- if (startsAt.isAfter(moment()) && endsAt.isAfter(moment())) {
- container.classList.add("future");
- _computeFutureEvent(container, startsAt);
- return;
- }
-
- if (startsAt.isBefore(moment()) && endsAt.isAfter(moment())) {
- container.classList.add("current");
- _computeCurrentEvent(container, endsAt);
- return;
- }
-
- if (startsAt.isBefore(moment()) && endsAt.isBefore(moment())) {
- container.classList.add("past");
- _computePastEvent(container, endsAt);
- return;
- }
-}
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/lib/full-calendar-default-options.js b/plugins/discourse-calendar/assets/javascripts/discourse/lib/full-calendar-default-options.js
deleted file mode 100644
index d4f5227d075..00000000000
--- a/plugins/discourse-calendar/assets/javascripts/discourse/lib/full-calendar-default-options.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import {
- getCalendarButtonsText,
- getCurrentBcp47Locale,
-} from "./calendar-locale";
-
-export default function fullCalendarDefaultOptions() {
- return {
- locale: getCurrentBcp47Locale(),
- buttonText: getCalendarButtonsText(),
- };
-}
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/models/discourse-post-event-event.js b/plugins/discourse-calendar/assets/javascripts/discourse/models/discourse-post-event-event.js
index 4759eb418d1..ea4a298bb18 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/models/discourse-post-event-event.js
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/models/discourse-post-event-event.js
@@ -41,7 +41,6 @@ export default class DiscoursePostEventEvent {
return new DiscoursePostEventEvent(args);
}
- @tracked title;
@tracked rrule;
@tracked name;
@tracked categoryId;
@@ -186,10 +185,6 @@ export default class DiscoursePostEventEvent {
return this.status === "private";
}
- get imageUrl() {
- return this.imageUpload?.url;
- }
-
get currentlyWithinEventTimeframe() {
return isWithinEventTimeframe(this.allDay, this.startsAt, this.endsAt);
}
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/models/discourse-post-event-reminder.js b/plugins/discourse-calendar/assets/javascripts/discourse/models/discourse-post-event-reminder.js
deleted file mode 100644
index 4decadac9e0..00000000000
--- a/plugins/discourse-calendar/assets/javascripts/discourse/models/discourse-post-event-reminder.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import RestModel from "discourse/models/rest";
-
-export default class DiscoursePostEventReminder extends RestModel {
- init() {
- super.init(...arguments);
-
- this.__type = "discourse-post-event-reminder";
- }
-}
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/routes/discourse-post-event-upcoming-events.js b/plugins/discourse-calendar/assets/javascripts/discourse/routes/discourse-post-event-upcoming-events.js
deleted file mode 100644
index 57afbfcba99..00000000000
--- a/plugins/discourse-calendar/assets/javascripts/discourse/routes/discourse-post-event-upcoming-events.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import Route from "@ember/routing/route";
-
-export default class extends Route {}
diff --git a/plugins/discourse-calendar/assets/stylesheets/common/discourse-calendar.scss b/plugins/discourse-calendar/assets/stylesheets/common/discourse-calendar.scss
index a595c76d541..0a6d44f8307 100644
--- a/plugins/discourse-calendar/assets/stylesheets/common/discourse-calendar.scss
+++ b/plugins/discourse-calendar/assets/stylesheets/common/discourse-calendar.scss
@@ -8,10 +8,6 @@ a.holiday {
cursor: default;
}
-.combo-box.user-timezone {
- min-width: 15em;
-}
-
.grouped-event {
--fc-event-bg-color: var(--primary-low);
--fc-event-border-color: var(--primary-low-mid);
@@ -26,23 +22,19 @@ a.holiday {
box-sizing: border-box;
margin-bottom: 1rem;
- &[data-size="auto"],
- &.auto {
+ &[data-size="auto"] {
height: auto;
}
- &[data-size="small"],
- &.small {
+ &[data-size="small"] {
height: 175px;
}
- &[data-size="medium"],
- &.medium {
+ &[data-size="medium"] {
height: 300px;
}
- &[data-size="large"],
- &.large {
+ &[data-size="large"] {
height: 600px;
}
}
@@ -117,12 +109,6 @@ a.holiday {
box-sizing: border-box;
overflow-y: auto;
- .group-timezones-header {
- .title {
- font-weight: 700;
- }
- }
-
.group-timezone,
.group-timezone-new-day {
box-sizing: border-box;
@@ -154,14 +140,6 @@ a.holiday {
transition: opacity 0.4s;
opacity: 0.5;
- &:first-child {
- margin-left: 0;
- }
-
- &:last-child {
- margin-right: 0;
- }
-
&.close-to-working-hours {
background-color: var(--calendar-close-to-working-hours);
opacity: 0.7;
diff --git a/plugins/discourse-calendar/assets/stylesheets/common/discourse-post-event-invitees.scss b/plugins/discourse-calendar/assets/stylesheets/common/discourse-post-event-invitees.scss
index 475ac64d2f6..35f212187fd 100644
--- a/plugins/discourse-calendar/assets/stylesheets/common/discourse-post-event-invitees.scss
+++ b/plugins/discourse-calendar/assets/stylesheets/common/discourse-post-event-invitees.scss
@@ -51,19 +51,6 @@
font-weight: bold;
}
}
-
- .status {
- margin-left: auto;
- margin-right: 0.5em;
-
- &.going {
- color: var(--success);
- }
-
- &.not_going {
- color: var(--danger);
- }
- }
}
}
}
diff --git a/plugins/discourse-calendar/assets/stylesheets/common/discourse-post-event.scss b/plugins/discourse-calendar/assets/stylesheets/common/discourse-post-event.scss
index 0025e83fd6e..153a2bd5175 100644
--- a/plugins/discourse-calendar/assets/stylesheets/common/discourse-post-event.scss
+++ b/plugins/discourse-calendar/assets/stylesheets/common/discourse-post-event.scss
@@ -18,10 +18,6 @@ $show-interested: inherit;
margin: var(--space-1) 0;
}
-.composer-onebox-node {
- white-space: normal;
-}
-
.discourse-post-event {
display: flex;
justify-content: center;
@@ -80,34 +76,6 @@ $show-interested: inherit;
section:last-child {
padding-bottom: 0.75em;
}
-
- .widget-dropdown {
- margin: 0;
-
- .widget-dropdown-header.disabled {
- pointer-events: none;
- }
-
- .widget-dropdown-item {
- &:not(.separator) {
- padding: 0.5em;
- }
-
- .d-icon + span {
- margin-left: 0.5em;
- }
- }
- }
- }
-
- &.is-loading {
- align-items: center;
- justify-content: center;
- }
-
- &.has-event {
- display: flex;
- flex-direction: column;
}
.event-header {
@@ -118,29 +86,6 @@ $show-interested: inherit;
.more-dropdown {
margin-left: auto;
-
- &.has-no-actions {
- display: none;
- }
-
- .widget-dropdown {
- .widget-dropdown-header {
- .d-icon {
- margin: 0;
- }
-
- .label {
- display: none;
- }
- }
-
- .item-closeEvent {
- .d-icon,
- span {
- color: var(--danger);
- }
- }
- }
}
&__controls {
@@ -237,10 +182,6 @@ $show-interested: inherit;
&.closed {
color: var(--danger-medium);
}
-
- .d-icon {
- margin-right: 0.5em;
- }
}
}
}
@@ -279,12 +220,6 @@ $show-interested: inherit;
}
}
- .event-creator {
- .username {
- margin-left: 0.25em;
- }
- }
-
.event-invitees {
min-height: 1.75em;
display: flex;
@@ -293,34 +228,6 @@ $show-interested: inherit;
overflow-y: auto;
flex-direction: column;
- .header {
- display: none;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 1em;
- width: 100%;
-
- .show-all {
- margin-left: 0.5em;
- }
-
- .event-invitees-status {
- font-weight: 700;
- display: flex;
-
- span:not(:last-child)::after {
- content: "-";
- font-weight: 400;
- margin: 0 0.3em;
- }
-
- .event-status-invited {
- font-weight: 600;
- color: var(--primary-medium);
- }
- }
- }
-
.event-invitees-avatars {
padding: 0;
margin: 0;
@@ -531,22 +438,11 @@ $show-interested: inherit;
// not ideal but a decent low tech solution
height: 24px;
- .participants {
- margin-left: 0.5em;
- color: var(--primary-medium);
- }
-
.discourse-local-date {
.d-icon {
display: none;
}
}
-
- .separator {
- color: var(--primary-high);
- margin: 0 0.5em;
- text-align: center;
- }
}
.discourse-post-event {
diff --git a/plugins/discourse-calendar/assets/stylesheets/common/livestream.scss b/plugins/discourse-calendar/assets/stylesheets/common/livestream.scss
index 09958e14d95..a28e0b4f864 100644
--- a/plugins/discourse-calendar/assets/stylesheets/common/livestream.scss
+++ b/plugins/discourse-calendar/assets/stylesheets/common/livestream.scss
@@ -25,10 +25,6 @@ body.chat-enabled.livestream-topic.confirmed-event-assistance {
}
}
-.discourse-calendar-livestream-zoom-entry-container {
- margin-top: 1rem;
-}
-
.discourse-calendar-livestream-zoom-entry {
display: flex;
flex-direction: column;
diff --git a/plugins/discourse-calendar/assets/stylesheets/mobile/discourse-calendar.scss b/plugins/discourse-calendar/assets/stylesheets/mobile/discourse-calendar.scss
index 7076802822e..a715af36a20 100644
--- a/plugins/discourse-calendar/assets/stylesheets/mobile/discourse-calendar.scss
+++ b/plugins/discourse-calendar/assets/stylesheets/mobile/discourse-calendar.scss
@@ -3,13 +3,5 @@
.calendar {
padding: 0;
-
- .fc-list-item-add-to-calendar {
- display: block;
- }
-
- &.fc-unthemed .fc-header-toolbar {
- padding: 0.5em 0;
- }
}
}
diff --git a/plugins/discourse-calendar/assets/stylesheets/mobile/discourse-post-event.scss b/plugins/discourse-calendar/assets/stylesheets/mobile/discourse-post-event.scss
index c5fdd2b985d..2b5e57ce010 100644
--- a/plugins/discourse-calendar/assets/stylesheets/mobile/discourse-post-event.scss
+++ b/plugins/discourse-calendar/assets/stylesheets/mobile/discourse-post-event.scss
@@ -9,19 +9,6 @@
}
}
- .event-actions {
- .event-status {
- width: 100%;
- display: flex;
- justify-content: space-between;
-
- button {
- padding: 0 0.6em;
- height: 2.5em;
- }
- }
- }
-
.event-invitees-status {
font-size: var(--font-down-1);
}
diff --git a/plugins/discourse-calendar/jobs/regular/discourse_post_event/event_started.rb b/plugins/discourse-calendar/jobs/regular/discourse_post_event/event_started.rb
deleted file mode 100644
index 21273be7f76..00000000000
--- a/plugins/discourse-calendar/jobs/regular/discourse_post_event/event_started.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-module Jobs
- class DiscoursePostEventEventStarted < ::Jobs::Base
- sidekiq_options retry: false
-
- def execute(args)
- raise Discourse::InvalidParameters.new(:event_id) if args[:event_id].blank?
- event = DiscoursePostEvent::Event.find(args[:event_id])
- MessageBus.publish("/topic/#{event.post.topic_id}", reload_topic: true, refresh_stream: true)
- DiscourseEvent.trigger(:discourse_post_event_event_started, event)
- end
- end
-end