Rename site setting holiday calendar post id to topic id
This commit is contained in:
parent
01e874a48d
commit
3cb3bb0e2e
|
@ -1,3 +1,4 @@
|
|||
en:
|
||||
site_settings:
|
||||
discourse_simple_calendar_enabled: "Enable the discourse-simple-calendar feature. This will add support for a [calendar][/calendar] tag in the first post of a topic."
|
||||
holiday_calendar_topic_id: "Topic ID of staffs holiday / absence calendar."
|
||||
|
|
|
@ -2,5 +2,5 @@ plugins:
|
|||
discourse_simple_calendar_enabled:
|
||||
default: true
|
||||
client: true
|
||||
discourse_simple_calendar_holiday_post_id:
|
||||
holiday_calendar_topic_id:
|
||||
default: ""
|
||||
|
|
|
@ -5,9 +5,10 @@ module Jobs
|
|||
PLUGIN_NAME ||= "discourse_simple_calendar".freeze
|
||||
|
||||
def execute(args)
|
||||
post_id = SiteSetting.discourse_simple_calendar_holiday_post_id
|
||||
topic_id = SiteSetting.holiday_calendar_topic_id
|
||||
return if topic_id.blank?
|
||||
|
||||
return if post_id.blank?
|
||||
post_id = Post.find_by(topic_id: topic_id, post_number: 1)
|
||||
|
||||
# Build a list of discourse users currently on holiday
|
||||
users_on_holiday = []
|
||||
|
|
|
@ -9,7 +9,7 @@ describe DiscourseSimpleCalendar::UpdateHolidayUsernames do
|
|||
[/calendar]
|
||||
MD
|
||||
@topic = Fabricate(:topic, first_post: create_post(raw: raw))
|
||||
SiteSetting.discourse_simple_calendar_holiday_post_id = @topic.first_post.id
|
||||
SiteSetting.holiday_calendar_topic_id = @topic.id
|
||||
end
|
||||
|
||||
it "should update users on holiday list" do
|
||||
|
|
Loading…
Reference in New Issue