Events Plugin šŸ“†

@steve_pd @tobiaseigen Thank you both. Current agenda:

1 Release email support for events. My work on this was disrupted by travel. Iā€™m putting the finishing touches on this now.

2 - Add a setting to add a hamburger menu item for events (the top menu item can currently be toggled in the top menu setting).

3 - Add site level equivalents for the category-specific settings.

4 - Fix the preview display issue.

5 - Review calendar mobile performance.

6 - Address long title display

7 - RSVP feature (this is lower on the list as itā€™s a bigger feature)

8 - Add event details to onebox previews

? - Event calendar for groups

5 Likes

Iā€™ve added links for the site-level calendar and agenda to the hamburger menu. The can be enabled (and disabled) using the events_hamburger_menu_calendar_link and events_hamburger_menu_agenda_link site settings.

https://github.com/angusmcleod/discourse-events/commit/2f2081e11c1b9824fda42a1b89891864c26d78cc

Live on my sandbox.

cc @tobiaseigen

3 Likes

Iā€™ve added site-level settings for:

There is already a site-level setting for ā€œNo text on add event buttonsā€.

For each site level setting mentioned above the category level setting will override the site level setting. For boolean settings, a false category-level setting will also override the site-level setting. This means that if you have already set a category-level setting for a category, the site level setting will not apply to the category.

Live on my sandbox.

cc @tobiaseigen

5 Likes

This oneā€™s not the events plugin, itā€™s the alt text for the image in that post.

Nevertheless, it would be nice to have some event details in oneboxes. As itā€™s feature task though, Iā€™ll add it to the end of the list.


Current list

1 Release email support for events. My work on this was disrupted by travel. Iā€™m putting the finishing touches on this now.

2 - Add a setting to add a hamburger menu item for events (the top menu item can currently be toggled in the top menu setting).

3 - Add site level equivalents for the category-specific settings.

4 - Fix the preview display issue.

5 - Review calendar mobile performance.

6 - Address long title display

7 - RSVP feature (this is lower on the list as itā€™s a bigger feature)

8 - Add event details to onebox previews

? - Event calendar for groups

2 Likes

This is fixed :sunny:

Live on the sandbox.

5 Likes

Hi @Angus. Great to see events appearing in email notifications :+1:

Would be good if the time zone and time zone offset could be omitted.

1 Like

My general thinking is that the timezone should be included in emails as there is no way to detect a userā€™s timezone in the email client.

Even for communities that are specific to an area like yours there still may be circumstances in which a timezone becomes useful, like when you went to Paris :fr:.

But perhaps I should still add a setting to not include timezones in emails. I can see the argument in your case. Iā€™ll add that this weekend.

Also, you should use the new default timezone site setting (i.e. set it to London rather than UTC).

2 Likes

Hi Angus, I noticed that setting and set the default timezone to London (although it kept flipping to Edinburgh? No biggie).

Would definitely like to be able to disable the timezone display on emails. Thanks for looking into this.

2 Likes

hm right, yeah, itā€™s because Iā€™m now using ā€œFriendlierā€ labels generated by Rails in the UI and the official zones underneath the hood. Sometimes two labels refer to the same zone.

The select-kit gets confused when two labels refer to the same value. Iā€™ll figure out some fix to that at some point, but as you say itā€™s not a big issue.

Iā€™ll add the setting soon.

3 Likes

Thanks. Also, somewhat concerning, the time shown in a recent email was 1 hour out:

This is the same event on the forum:

Probably a daylight saving time issue. I could have sworn I set the timezone to London. Should this be sufficient for the plugin to account for daylight saving time adjustment?

Also the date appears to show as a range although only a single date was entered.

3 Likes

@angus kindly helped me test the issue with dates in emails being one hour out. It looks like the timezone setting on my forum must have been UTC at the time of the issue (rather than London) which meant that this was a daylight savings time issue.

I could have sworn I set the timezone correctly when I first installed the plugin but in any case, I donā€™t think there is any issue with the plugin itself here.

Thanks, Angus, for your help diagnosing this.

5 Likes

Please consider adding language files to Transifex. Iā€™d like to translate to Russian.

1 Like

Theyā€™re actually there already :slight_smile:

This pluginā€™s Travis CI runs:

  • All the core rspec tests (partly to ensure emails work properly)

  • Itā€™s own tests.

  • Syncs the repo with Transifex.

6 Likes

Hi @Angus, me again Iā€™m afraid!

I had a report from a user whose topic date/time was showing an hour out in the topic list today. Mine was correct.

Both the ā€œallow user localeā€ and " set locale from accept language header" site settings are false, and Iā€™m baffled by this issue.

Any help would be much appreciated

3 Likes

Ok, Iā€™ll take a look tomorrow.

2 Likes

Is it possible that the userā€˜s computer/phone has a wrong timezone? The locale is only used for date/time formatting using moment.js afaik. The time for your event shown to me is also 20:30. My timezone is Berlin.

2 Likes

That is entirely possible as the user is from Germany I think!

Iā€™d still want the events to be shown in London time for all users though, due to the nature of my forum

1 Like

As @craisp suggested, the way itā€™s meant to work is that it shows the user the event time in their own timezone. If the user is in Germany the time will be different.

I added the setting Include timezone in event label. to handle the case of users in multiple timezones, i.e. so there would be no confusion about what time was being displayed.

However I guess youā€™re after a setting that will always show the event in a certain timezone.

Well now that we have a default timezone, this is possible without also requiring the timezone to be entered each time an event is added. So Iā€™ll add it.

Updated tasklist (for my reference);

1 - Address long title display.

2 - Add setting to always display time in default timezone, unless timezone is explicitly set.

3 - RSVP feature(@steve_pd I havenā€™t forgotten about this, sorry itā€™s taking so long).

4 - Add event details to onebox previews.

? - Event calendar for groups

3 Likes

New feature: Event cards.

Screenshot%20at%20Apr%2013%2016-46-58

Now when you click on an event in the calendar in desktop, you will see an event card, with the topic title, metadata (including event label) and a topic excerpt. Clicking the title, the event label or the excerpt takes you to the topic itself. Event cards do not display on mobile. They are somewhat similar to the event details display in Google Calendar.

@tobiaseigen This addresses the title display issue.

https://github.com/angusmcleod/discourse-events/commit/dd04227c53af0313bab2601f42bfeef5e58e034a

8 Likes

Timezones update

Iā€™ve simplified the way timezones are handled.

Event creation, editing and display

For creating, editing and displaying an event, the timezone is set according to this hierarchy:

// Start with the user's timezone, guessed by momentjs.
let timezone = moment.tz.guess();

// If a default timezone is set in the site setting use that instead.
const defaultTimezone = Discourse.SiteSettings.events_default_timezone;
if (defaultTimezone) {
  timezone = defaultTimezone;
}

// If the event has a custom timezone use that instead.
if (event['timezone']) {
  timezone = event['timezone'];
}

return timezone;

The decision on whether or not to display a timezone label next to a datetime is determined according to this logic:

const defaultTimezone = Discourse.SiteSettings.events_default_timezone;
const standardTimezone = defaultTimezone || moment.tz.guess();

if (!allDay && event['timezone'] && event['timezone'] !== standardTimezone) {
  dateString += `, ${timezoneLabel(event['timezone'])}`;
}

Basically, if the event is not an all day event and has a custom timezone that is different from the standard timezone (either the site setting or the userā€™s own timezone), then the timezone is displayed.

Zone list

Iā€™ve also updated the timezone list (used for both the default timezone setting and the custom timezone input in event creation / editing modal) to filter duplicate values in the ActiveSupport::TimeZone::MAPPING. This simplifies the selection of zones (e.g. prevents issues with having objects with duplicate keys in a combo-box)

timezones = ActiveSupport::TimeZone::MAPPING
zone_map = []
remove_zones = []

# Remove the duplicate zones where the label doesn't include the city in the zone.
timezones.each do |k, v|
  if zone_map.include?(v)
    duplicates = timezones.select { |key, val| val === v }
    remove = duplicates.select{ |key, val| !val.include?(key) }
    remove_zones.push(*remove.keys)
  end

  zone_map.push(v)
end

timezones.except!(*remove_zones)

Basically, this means that when you have two or more ā€œReadableā€ labels referring to the same IANA zone such as

"Edinburgh" => "Europe/London",
"London" => "Europe/London"

The zone with a label that does not match in the city in the IANA zone is removed. In this case Edinburgh would be removed.

Emails

The timezone of event times in emails is set according to this logic:

event_timezone = SiteSetting.events_default_timezone
event_timezone = event[:timezone] if event[:timezone].present?

i.e. Start with the default timezone, then use the custom event timezone if one is used.

Iā€™ve also added a setting that toggles the display of timezones in event emails: events_emails_include_timezones. Default is true. The event time in the email is still going to be localised according to the logic above regardless of this setting.

@ChrisBeach Amongst other things, I hope this addresses your various timezone issues.

https://github.com/angusmcleod/discourse-events/commit/8fd960e2c3e65a0996155bead509891a04748004

9 Likes