mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Automatically timed delete stub topics after entire topic is merged into another topic (#13187)
When a topic is fully merged into another topic we close it. Now we want also to set a timer for deleting this topic. By default, stub topics will be deleted in 7 days. Users can change this period or disable auto-deleting by setting the period to 0.
This commit is contained in:
committed by
GitHub
parent
47e09700fe
commit
74f7150324
@@ -79,7 +79,7 @@ class PostMover
|
||||
update_bookmarks
|
||||
|
||||
if moving_all_posts
|
||||
@original_topic.update_status('closed', true, @user)
|
||||
close_topic_and_schedule_deletion
|
||||
end
|
||||
|
||||
destination_topic.reload
|
||||
@@ -546,4 +546,17 @@ class PostMover
|
||||
topic_id: topic.id
|
||||
)
|
||||
end
|
||||
|
||||
def close_topic_and_schedule_deletion
|
||||
@original_topic.update_status('closed', true, @user)
|
||||
|
||||
days_to_deleting = SiteSetting.delete_merged_stub_topics_after_days
|
||||
if days_to_deleting > 0
|
||||
@original_topic.set_or_create_timer(
|
||||
TopicTimer.types[:delete],
|
||||
days_to_deleting * 24,
|
||||
by_user: @user
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user