mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
4af77f1e38
This PR allows entering a float value for topic timers e.g. 0.5 for 30 minutes when entering hours, 0.5 for 12 hours when entering days. This is achieved by adding a new column to store the duration of a topic timer in minutes instead of the ambiguous both hours and days that it could be before. This PR has ommitted the post migration to delete the duration column in topic timers; it will be done in a subsequent PR to ensure that no data is lost if the UPDATE query to set duration_mintues fails. I have to keep the old keyword of duration in set_or_create_topic_timer for backwards compat, will remove at a later date after plugins are updated.
15 lines
315 B
Ruby
15 lines
315 B
Ruby
# frozen_string_literal: true
|
|
|
|
class TopicTimerSerializer < ApplicationSerializer
|
|
attributes :id,
|
|
:execute_at,
|
|
:duration_minutes,
|
|
:based_on_last_post,
|
|
:status_type,
|
|
:category_id
|
|
|
|
def status_type
|
|
TopicTimer.types[object.status_type]
|
|
end
|
|
end
|