Skip to content

Commit

Permalink
add api support
Browse files Browse the repository at this point in the history
  • Loading branch information
angusmcleod committed Oct 18, 2017
1 parent 9d7a761 commit 33ba86f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugin.rb
Expand Up @@ -88,8 +88,9 @@ def include_event?
if post.is_first_post? && opts[:event]
topic = Topic.find(post.topic_id)

event_start = opts[:event]['start']
event_end = opts[:event]['end']
event = opts[:event].is_a?(String) ? ::JSON.parse(opts[:event]) : opts[:event]
event_start = event['start']
event_end = event['end']

topic.custom_fields['event_start'] = event_start.to_datetime.to_i if event_start
topic.custom_fields['event_end'] = event_end.to_datetime.to_i if event_end
Expand Down

0 comments on commit 33ba86f

Please sign in to comment.