mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Warn when reviving a topic that has been inactive for X days. Setting warn_reviving_old_topic_age controls when the warning is shown. Set it to 0 to disable this feature.
This commit is contained in:
@@ -6,6 +6,7 @@ class ComposerMessagesFinder
|
||||
end
|
||||
|
||||
def find
|
||||
check_reviving_old_topic ||
|
||||
check_education_message ||
|
||||
check_new_user_many_replies ||
|
||||
check_avatar_notification ||
|
||||
@@ -123,6 +124,21 @@ class ComposerMessagesFinder
|
||||
body: PrettyText.cook(I18n.t('education.dominating_topic', percent: (ratio * 100).round)) }
|
||||
end
|
||||
|
||||
def check_reviving_old_topic
|
||||
return unless @details[:topic_id]
|
||||
|
||||
topic = Topic.where(id: @details[:topic_id]).first
|
||||
|
||||
return if topic.nil? ||
|
||||
SiteSetting.warn_reviving_old_topic_age < 1 ||
|
||||
topic.last_posted_at > SiteSetting.warn_reviving_old_topic_age.days.ago
|
||||
|
||||
{templateName: 'composer/education',
|
||||
wait_for_typing: false,
|
||||
extraClass: 'urgent',
|
||||
body: PrettyText.cook(I18n.t('education.reviving_old_topic', days: (Time.zone.now - topic.last_posted_at).round / 1.day)) }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def creating_topic?
|
||||
|
Reference in New Issue
Block a user