Commit Graph

152 Commits

Author SHA1 Message Date
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
Sam aa7086b14c
DEV: update holiday definitions (#130) 2021-05-05 12:17:00 +10:00
Vinoth Kannan 3b1f1ea5ed
FIX: retrieve custom fields from preloaded data to stop N+1 issue. (#128)
All the preloaded custom fields are stored in `TopicView`'s post_custom_fields property. To prevent N+1 we should use that instead of `post.custom_fields` method.
2021-05-03 09:06:25 +02:00
Dan Ungureanu 776e3d1b9d
FIX: Show holiday name only once (#120) 2021-04-23 19:16:29 +03:00
Dan Ungureanu 4d9d30fe18
FIX: Handle multiple holidays in the same day (#118)
If a user had two holidays in the same day, the calendar would show
only of them, but the username would be shown twice. This ensures the
calendar shows both holidays and the username only once.
2021-04-14 11:42:21 +03:00
Gerhard Schlager 11397e2910
DEV: Fix flaky spec (#103) 2021-02-09 18:24:26 +01:00
Krzysztof Kotlarek 21d536de5d
FIX: randomly failing export CSV spec (#81)
The test is failing because of an incorrect order. I added an order by `created_by`.

Also, I needed to split create_invitess because it is using the same date for `created_at`

```ruby
def create_invitees(attrs)
  timestamp = Time.now
  attrs.map! do |attr|
    {
      post_id: self.id, created_at: timestamp, updated_at: timestamp
    }.merge(attr)
  end

  self.invitees.insert_all!(attrs)
end
```
2020-12-14 10:52:03 +11:00
Régis Hanol 94600a8508 FIX: properly handle holidays in the same week
UX: sort usernames in grouped holidays
2020-11-27 18:06:40 +01:00
Krzysztof Kotlarek 9f69f273ad
FIX: move post events into separate tables (#70)
* FIX: correctly destroys standalone calendar events (#66)

Standalone events are mostly created for holidays where we create a calendar event not associated to any post of of the topic, before this change, the loop was exited before collecting the ID of the calendar event to be destroyed.
2020-11-25 09:32:51 +11:00
Daniel Waterworth 77744d4c65
FIX: find_each does not respect ordering clauses (#74)
`find_each` gets the rows in batches, ordered by the primary key, so
ordering clauses are ignored. I assume this is fine, because If it is
not OK to fetch them all from postgres, then it is also not OK to send
them all to the client at once.
2020-11-24 12:13:10 -06:00
Régis Hanol 44521c65c3
FIX: sort calendar_details for better holidays support (#71) 2020-11-19 17:30:15 +01:00
Joffrey JAFFEUX 9560350108
FEATURE: more dynamic event dates in topic titles (#61)
- always auto updated
- correctly computed, based on past/current/future event
- displays a green indicator when an event is on going
2020-09-27 14:25:27 +02:00
jjaffeux b7b6213983 FIX: non staff users part of allowed groups can only edit own event 2020-09-24 15:25:02 +02:00
jjaffeux 0854550fe4 UX: improved dates styles in topics and dates are now relative 2020-09-19 12:52:43 +02:00
jjaffeux b41c49c34e FIX: makes every_month use the same weekday 2020-09-12 23:09:43 +02:00
jjaffeux a64735750f FIX: keys returns an array not a string
Followup to 88e26b26
2020-09-04 17:29:49 +02:00
jjaffeux 88e26b26b6 UX: do not notify ongoing invitees when only editing tags 2020-09-04 16:02:40 +02:00
jjaffeux ae6f7c9d25 FIX: custom fields are now part of markdown 2020-08-25 13:22:09 +02:00
jjaffeux d1bf3bafeb DEV: simpler post eval 2020-08-20 15:21:26 +02:00
jjaffeux 2399624f51 FIX: sends event creation's notification to all potential invitees
When in private event, we don't create invitees, although we know the list of people who can join, send an invite to this list.

Also fixes the total count of users on private events.
2020-08-13 16:20:49 +02:00
jjaffeux 60f9d6cf4f FIX: ensures invitees are notified again when recurrence is used 2020-08-13 10:46:27 +02:00
jjaffeux 019847948c FEATURE: intoduces recurrence support
For now: every_week/every_day/every_month/every_weekday (monday to friday)
2020-08-13 10:19:13 +02:00
jjaffeux b5e388a74c FEATURE: allows to extend the edit notifications period 2020-08-11 14:04:00 +02:00
jjaffeux 49e4cca2c2 REFACTOR: removes dead code 2020-08-11 08:18:12 +02:00
jjaffeux 1e62bfa8c8 REFACTOR: removes dead code 2020-08-11 08:02:41 +02:00
jjaffeux ad57efb6fe REFACTOR: makes reminders to be in raw 2020-08-10 23:38:04 +02:00