Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: expired events from PM not visible in upcoming events calendar #525

Merged
merged 1 commit into from Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 12 additions & 11 deletions assets/javascripts/discourse/components/upcoming-events-calendar.js
Expand Up @@ -113,24 +113,26 @@ export default Component.extend({
(entry) =>
entry.type === "tag" && post.topic.tags.includes(entry.slug)
);
backgroundColor = tagColorEntry ? tagColorEntry.color : null;
backgroundColor = tagColorEntry?.color;
}

if (!backgroundColor) {
const categoryColorFromMap = tagsColorsMap.find(
const categoryColorEntry = tagsColorsMap.find(
(entry) =>
entry.type === "category" &&
entry.slug === post.topic.category_slug
)?.color;
backgroundColor =
categoryColorFromMap ||
`#${this.site.categoriesById[category_id]?.color}`;
);
backgroundColor = categoryColorEntry?.color;
}

const categoryColor = this.site.categoriesById[category_id]?.color;
if (!backgroundColor && categoryColor) {
backgroundColor = `#${categoryColor}`;
}

let borderColor, textColor;
let classNames;
if (moment(ends_at || starts_at).isBefore(moment())) {
borderColor = textColor = backgroundColor;
backgroundColor = "unset";
classNames = "fc-past-event";
}

this._calendar.addEvent({
Expand All @@ -140,8 +142,7 @@ export default Component.extend({
allDay: !isNotFullDayEvent(moment(starts_at), moment(ends_at)),
url: getURL(`/t/-/${post.topic.id}/${post.post_number}`),
backgroundColor,
borderColor,
textColor,
classNames,
});
});

Expand Down
4 changes: 4 additions & 0 deletions assets/stylesheets/common/upcoming-events-calendar.scss
Expand Up @@ -118,6 +118,10 @@
}
}

.fc-past-event {
opacity: 0.3;
}

.fc-left {
.fc-button-group:first-child {
margin-left: 0;
Expand Down