Discourse Calendar

Just leave

[calendar]
[/calendar]

In first post, CREATE IT, don’t rely on preview, actually create it. And then answer to this with a post containing a date created with the icon from the menu.

5 Likes

Can I use the “holidays” from outside of discourse? (atom/ical support for eg.)

No support for this ATM, and if output has been thought, I’m unsure we want to do input.

2 Likes

This solved my problems. Thank you for understanding.

1 Like

I made a test holiday post, but I see something strange:

So, if the holiday lasts till yesterday, I should not have an on holiday flare, right?

Is sidekiq properly running?

Are there any errors in example.com/logs that might be related?

1 Like

If example.com/disdekiq looks like this, than can I say, yes?

Seems no.

1 Like

If you go to example.com/sidekiq/scheduler, are the jobs starting with DiscourseCalendar:: working properly and frequently?

Yes, seems so.

1 Like

Can you tell me what these commands return in the rails console?

SiteSetting.calendar_enabled
topic_id = SiteSetting.holiday_calendar_topic_id
op = Post.find_by(topic_id: topic_id, post_number: 1)
op.custom_fields[::DiscourseCalendar::CALENDAR_DETAILS_CUSTOM_FIELD]

Note, that I have deleted my reply to the holiday topic which added the holiday period. So now, no holidays in that topic.

root@mercury-discourse:/var/www/discourse# rails c
[1] pry(main)> SiteSetting.calendar_enabled
=> true
[2] pry(main)> topic_id = SiteSetting.holiday_calendar_topic_id
=> "143"
[3] pry(main)> op = Post.find_by(topic_id: topic_id, post_number: 1)
=> #<Post:0x00007f6666714cf0
 id: 353,
 user_id: 1,
 topic_id: 143,
 post_number: 1,
 raw: "[calendar]\n[/calendar]",
 cooked: "<div class=\"calendar\" data-calendar-type=\"dynamic\"></div>",
 created_at: Fri, 17 May 2019 14:22:23 UTC +00:00,
 updated_at: Fri, 17 May 2019 14:28:43 UTC +00:00,
 reply_to_post_number: nil,
 reply_count: 0,
 quote_count: 0,
 deleted_at: nil,
 off_topic_count: 0,
 like_count: 0,
 incoming_link_count: 0,
 bookmark_count: 0,
 avg_time: nil,
 score: 1.0,
 reads: 5,
 post_type: 1,
 sort_order: 1,
 last_editor_id: 1,
 hidden: false,
 hidden_reason_id: nil,
 notify_moderators_count: 0,
 spam_count: 0,
 illegal_count: 0,
 inappropriate_count: 0,
 last_version_at: Fri, 17 May 2019 14:28:43 UTC +00:00,
 user_deleted: false,
 reply_to_user_id: nil,
 percent_rank: 0.5,
 notify_user_count: 0,
 like_score: 0,
 deleted_by_id: nil,
 edit_reason: nil,
 word_count: 2,
 version: 2,
 cook_method: 1,
 wiki: false,
 baked_at: Fri, 17 May 2019 14:28:43 UTC +00:00,
 baked_version: 2,
 hidden_at: nil,
 self_edits: 3,
 reply_quoted: false,
 via_email: false,
 raw_email: nil,
 public_version: 2,
 action_code: nil,
 image_url: nil,
 locked_by_id: nil>
[4] pry(main)> op.custom_fields[::DiscourseCalendar::CALENDAR_DETAILS_CUSTOM_FIELD]
=> {}
[5] pry(main)>
1 Like

Thanks, I think I see a bug in the code.

Having a look :mag_right:

3 Likes

Actually, can you tell me what these commands return?

op.custom_fields[::DiscourseCalendar::CALENDAR_HOLIDAYS_CUSTOM_FIELD]
DiscourseCalendar.users_on_holiday
[4] pry(main)> op.custom_fields[::DiscourseCalendar::CALENDAR_HOLIDAYS_CUSTOM_FIELD]
=> nil
[5] pry(main)> DiscourseCalendar.users_on_holiday
=> []
[6] pry(main)> 
1 Like

You’d need to do that after the above topic_id = and op = commands.

If I had done otherwise, I would have got error about undefined op.

2 Likes

Everything looks good, last thing, does example.com/site.json have a “users_on_holiday” property?

Yes, and it’s value is empty array.

Then the plugin seems to be working just fine…

Are you sure that icon is coming from this plugin?

Seems so (if this icon is coming from that plugin)

image

1 Like