Commit Graph

177 Commits

Author SHA1 Message Date
Jean d27e52e340
FEATURE: customizable event colors by tags and adjustable max rows in calendar (#482)
* FEATURE: customizable event colors by tags and adjustable max rows
2023-12-01 10:10:34 -04:00
Krzysztof Kotlarek 07ff8f4f1b
FEATURE: Show all upcoming events for the next year (#483)
Display upcoming recurrent events for a year.
In addition, download calendar is creating recurrent entries.
2023-11-30 13:56:05 +11:00
Krzysztof Kotlarek ce74ed4879
FIX: regional public holidays day early (#486)
When a public holiday is created, it is created in a specific user time zone.

https://github.com/discourse/discourse-calendar/blob/main/jobs/scheduled/create_holiday_events.rb#L71

When calendar is set as fullDay, we would like to display Christmas always 25th of December.

To achieve that, we need to have information about timezone, parse date in that timezone, and leave only year, month and day.

I added a test case to cover one bug scenario. User from Los Angeles have seen that user from Italy was celebrating Christmas Day on 24th of December instead of 25th.
2023-11-22 14:44:42 +11:00
Isaac Janzen 21986cc399
DEV: Upgrade post-event-builder modal to Component API (#480) 2023-11-14 14:02:38 -07:00
Bianca Nenciu 7e9b77a750
DEV: Use new API to preload category custom fields (#475) 2023-11-09 18:51:56 +02:00
Martin Brennan f9f8e9d719
DEV: Metadata update for plugin.rb (#470)
* Update plugin.rb metadata

* Update plugin.rb

---------

Co-authored-by: AlexDev <104522507+alexdevlaeminck@users.noreply.github.com>
2023-11-07 17:29:23 -08:00
Bianca Nenciu 0d5a12cb40
FIX: Preload category custom fields (#472) 2023-11-02 16:56:32 +02:00
Renato Atilio f57b09ce8b
FEATURE: upcoming events list component (#463)
* FEATURE: upcoming events list component
2023-10-30 15:34:12 -03:00
David Taylor 9788310906
SECURITY: Properly escape user input when generating email HTML (#455) 2023-10-16 15:00:44 +01:00
Jan Cernik 3fa341639b
FEATURE: Display calendar events adjusted for timezones (#432)
Adds the option to enable a timezone adjustment for calendar events.
This will make it so events render offset from the grid to reflect the
appropriate start and end moments according to the viewer's timezone.
2023-09-11 11:42:18 -03:00
Jarek Radosz 6761e2c84f
DEV: Clean up the plugin (#426) 2023-08-01 22:32:30 +02:00
David Taylor 8d1c24c76e
DEV: Resolve add_to_serializer deprecations (#403)
26b7f8a63b
2023-04-24 16:06:34 +01:00
Bianca Nenciu f45a1ee588
DEV: Update plugin to match latest guidelines (#396) 2023-03-22 20:48:04 +02:00
Bianca Nenciu 8f69c1165b
DEV: Update plugin to match latest guidelines (#390)
- Define extension modules
- Use different files instead of plugin.rb
- Make sure plugin is disabled according to the setting
2023-02-23 15:25:06 +02:00
Jan Cernik e932c9fb43
FIX: The event doesn't load after creating it (#375) 2023-01-13 16:03:10 -03:00
Selase Krakani 35a2d0b498
FIX: Make users_on_holiday return type consistent (#373)
Return an empty array instead of nil when the plugin store has not yet
been populated with `users_on_holiday`.

At the moment, the `currently_away` report fails if the
`UpdateHolidayUsernames` never gets the chance to update `users_on_holiday`.
2023-01-10 12:22:44 +00:00
David Taylor 3e9ab14bcd
DEV: Introduce syntax_tree for ruby formatting (#363) 2022-12-29 13:30:41 +01:00
Jan Cernik f4f16d958e
FEATURE: Add option to bump topic (#344)
It allows you to set an auto-bump topic timer based on the start date of an event
2022-12-01 09:14:07 -03:00
David Taylor 9045f0644a
DEV: Fix Zeitwerk reloading in development (#349)
These overrides are not using the DiscoursePluginRegistry, and therefore need to be re-applied after a Zeitwerk reload to prevent errors
2022-11-23 10:01:26 +00:00
Andrei Prigorshnev 7adaec219f
SECURITY: Bump the version (#346)
Due to the security fix ca5ae3e7e0
2022-11-14 20:31:50 +04:00
Andrei Prigorshnev e0efb16264
DEV: Drop hidden setting which was making holiday status public (#337) 2022-10-28 14:51:35 +04:00
Andrei Prigorshnev ccb4993e57
FEATURE: when user is on holiday set user status in core (#333)
Before, the calendar plugin was setting this custom holiday flair in many places in Discourse. Starting from this PR, the calendar plugin will be setting user status in core instead.

Note that from now we start to show holiday's end date. If a user has several holiday events simultaneously (this can happen easily, for example, if a user is on vacation and today is a public holiday in their country), the date will be taken from the longest event.

Note also that there is an edge case that's not handled in this PR - if a user has several holidays one after another (let's say they are sick this week and has a vacation on the next week), it would be nice to show as the end date of the holiday the ending date of the second holiday. For now, the plugin uses the end date of the current holiday in such cases, but I'll improve it in one of the next PRs.

Also, in this PR, I directly use methods of the user model from Core. We definitely need API calls instead. This fix is also coming soon.
2022-10-24 16:57:53 +04:00
David Taylor d0908b9b2e
DEV: Ensure ends_at preloading persists in development (#327)
This was causing an error on topic lists after a zeitwerk reload. Using the official plugin API takes care of reloading correctly.

Followup to 139fdd9cc3
2022-09-28 11:17:33 +01:00
Frank 6820f7a433
Feature/sort by event start date (#320)
FEATURE:
 - Added custom fields `sort_topics_by_event_start_date` and `disable_topic_resorting`
 - Sort topics of event categories by event start date. Event categories have custom field `sort_topics_by_event_start_date` set to true.
 - Disable re-sorting of categories with custom field `disable_topic_resorting`
 - Event date displayed beside the Topic title can optionally be set to show the local date-time, instead of relative date-time.
 -
2022-09-23 06:02:48 +08:00
David Taylor 139fdd9cc3
DEV: Ensure topic_list custom field preloading persists in development (#324)
This was causing an error on topic lists after a zeitwerk reload. Using the official plugin API takes care of reloading correctly.
2022-09-22 10:27:48 +01:00
David Taylor 799c3515ce
FEATURE: Allow post events to be edited based on post guardian (#303)
If someone has edit access on a post (e.g. they're TL4), then it makes sense for them to be able to edit the attached event
2022-07-25 14:57:53 +01:00
Régis Hanol 23dd3830bd
FIX: delete event posts not automatic holidays (#292)
Renamed the 'DestroyPastEvents' job to 'DeleteExpiredPostEvents' and changed its behavior
to only delete posts (and their replies) that have an expired event.

Previously it would also delete expired 'CalendarEvents' but that was messing with our automated
holidays tracking.

Used 'post.reply_ids' to retrieve all the replies to a post, and not only the direct replies.
This helps keep the topic cleaner by removing the whole reply chain.
2022-07-01 11:02:19 +02:00
Shaun d31e07c01c
Allow admins to enable and disable holidays (#283)
* DEV: Add backend functionality to enable/disable holidays

This will add two backend endpoints, one to disable holidays and
another to enable holidays.

I also introduced a new `Holiday` service that is responsible for
getting the holidays and attaching a new `disabled` attribute to the
holidays. The `#index` action has been updated to use this new service,
so it will return this new `disabled` attribute.

* DEV: Only add enabled holidays to the calendar

I updated this job so that it will use the new `Holiday` service, which
will return the holidays like before but with a new `disabled` field,
which this job will use to only add enabled holidays to the calendar.

* FEATURE: Allow admins to disable/enable holidays

The main thing I added here is a new component `admin-holiday-list-item`
that is responsible for displaying a holiday, and an enable or disable
button and the corresponding functionality.
2022-06-28 19:43:20 -03:00
David Taylor 67b81b3d69
DEV: Add hidden setting which makes holiday status public (#288)
This is a temporary addition, pending a more radical refactoring of the holiday-emoji-flair system.
2022-06-17 18:26:42 +01:00
Shaun 910ce2dde6
FEATURE: Allow admins to view holidays by region (#275) 2022-06-03 13:26:14 -04:00
Shaun 0e154a62a0
DEV: Add API endpoints for holidays (#269)
Adds two new endpoints available to admins:
* `/admin/discourse-calendar/holiday-regions` - this will return a list of holiday regions (as defined by the Holidays gem)
* `/admin/discourse-calendar/holiday-regions/:id/holidays` - this will return all of the holidays for a given region
2022-05-17 10:26:19 -04:00
Bianca Nenciu c2fd735037
FIX: Make region visible to current user too (#267)
The 'holidays-region' custom field used to be visible only to staff
members, but editable by the current user. This meant that the user
could edit the value, but could not see the value after it was set.
This caused the input field from their user preferences page to be
always blank for regular users.
2022-05-16 16:05:24 +03:00
Joffrey JAFFEUX 7d10944055
FEATURE: adds support for timezone (recurring and non recurring) (#237) 2022-03-03 12:03:21 +01:00
Loïc Guitaut c3a09e2ec5 DEV: Update the rrule gem (Rails 7+ compatibility) 2022-03-02 10:42:58 +01:00
Joffrey JAFFEUX 20d012516c
FEATURE: adds a currently away report (#234) 2022-02-25 15:46:45 +01:00
Jarek Radosz ad1fc42773
DEV: Drop old code (#230)
Resolving some post-release TODOs
2022-02-24 01:15:49 +01:00
Jarek Radosz aeb12bf7de
DEV: Update rrule gem (#229) 2022-02-24 01:14:23 +01:00
Jarek Radosz d93343e997
DEV: Remove old ics code (#231) 2022-02-23 23:38:38 +01:00
Jarek Radosz b7e0441e77
DEV: Enable js transpilation (#222) 2022-02-10 22:23:38 +01:00
Krzysztof Kotlarek e852072f30
FEATURE: fullDay calendar option (#207)
Allow calendar to disrespect timezones and always display full day for standalone and group events.

Standalone events are saved in specific timezone: https://github.com/discourse/discourse-calendar/blob/main/app/models/calendar_event.rb#L62

However, we don't store information about timezone. It is essential to have that information to calculate date properly. Therefore, a new column was added.
2022-01-06 09:51:11 +01:00
Roman Rizzi 365a90912e
DEV: Use Procs instead of lambdas for the consolidation rule. (#202)
Using procs lets us pass additional arguments to the function without breaking existing ones.
2021-12-22 15:23:02 -03:00
Joffrey JAFFEUX 0b423413e4
DEV: adds support for event url in event_started trigger (#194) 2021-12-14 09:19:55 +01:00
Roman Rizzi 13549ac176
FEATURE: Re-use existing invite and reminders notifications. (#191)
Instead of creating new notifications for recurring events, we use our consolidation API to bump existing ones.
2021-12-10 11:28:43 -03:00
Joffrey JAFFEUX c9644eb476
DEV: adds event started triggerable for automation (#193) 2021-12-07 20:39:31 +01:00
Joffrey JAFFEUX 28e156d55d
DEV: whiteList is deprecated (#186) 2021-10-27 15:11:05 +02:00
Krzysztof Kotlarek 5c9e7b3044
FIX: small region preferences select (#176)
Reduce size of user region preferences
2021-10-06 10:13:05 +11:00
Alan Guo Xiang Tan 14a7649840 Fix plugin's compatibility with older discourse versions.
Follow-up to d469260bf9
2021-06-17 09:13:22 +08:00
Alan Guo Xiang Tan 10456a93a2
FIX: Holidays gem not required in Sidekiq. 2021-06-09 10:49:09 +08:00
Alan Guo Xiang Tan d469260bf9 PERF: N+1 queries while loading `Post#event` in a topic. 2021-06-07 15:20:08 +08:00
Alan Guo Xiang Tan 0e3431f111 Hard fork holidays/holidays gem into plugin.
The original gem does not seem to be maintained anymore so we're pulling
this into the plugin so that we can update the definitions easily.
2021-06-07 10:54:52 +08:00