From 0ad3fad36c055417bde6acfe59a1f515168be74e Mon Sep 17 00:00:00 2001 From: saint Date: Thu, 29 Aug 2024 23:24:36 +1000 Subject: [PATCH] More goss-cleanup improvements --- goss-cleanup.rb | 14 +++++++------- goss-search.rb | 12 ++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/goss-cleanup.rb b/goss-cleanup.rb index b7a0191..7514a60 100644 --- a/goss-cleanup.rb +++ b/goss-cleanup.rb @@ -83,13 +83,13 @@ class GossamerForumsCleaner puts "Identified topic for deletion: Title: #{topic.title} Topic ID: #{topic.id}" # Destroy all posts in the topic -# topic.posts.each do |post| -# puts "Deleting post #{post.id} in topic #{topic.id}" -# post.destroy -# end -# -# # Destroy the topic itself -# topic.destroy + topic.posts.each do |post| + puts "Deleting post #{post.id} in topic #{topic.id}" + post.destroy + end + + # Destroy the topic itself + topic.destroy end end diff --git a/goss-search.rb b/goss-search.rb index eb6b070..ea4af0c 100644 --- a/goss-search.rb +++ b/goss-search.rb @@ -27,6 +27,18 @@ class GossamerForumsSearch puts "Bumped At: #{topic.bumped_at}" puts "Last Post User ID: #{topic.last_post_user_id}" puts "----------------------------------------" + + # Fetch and display all posts for the topic + topic.posts.each do |post| + puts " Post ID: #{post.id}" + puts " User ID: #{post.user_id}" + puts " Created At: #{post.created_at}" + puts " Updated At: #{post.updated_at}" + puts " Post Number: #{post.post_number}" + puts " Cooked: #{post.cooked.truncate(80)}" # Limit the display of post content to 100 characters + puts " Raw: #{post.raw.truncate(80)}" # Limit the display of raw post content to 100 characters + puts " ----------------------------------------" + end end if matching_topics.empty?