Would it be possible to include admin tools on the small action posts (the closed/pinned etc. messages?) Such as allowing for permanent deletion, changing of ownership and the like.
I’m the only admin user on my site, and while these posts are hidden away as soft deletions, they’re still kind of ugly - even as an staff user. Sometimes I jot things down in soft-deleted messages too before making rough drafts into proper posts, so it becomes a bit difficult to distinguish these from the small action messages whenever I click in to show hidden replies.
I also don’t really want to use CSS in a component - because there are a few instances where I want the small action message to be displayed such as letting users know I’ve archived or closed specific topics. I just don’t want the streams of pinned/unpinned/pinned/unpinned etc - we’ve all seen this before so I think you get the gist of what I mean.
For context, I run a small site with about 10 users which I basically use as a digital library for various notes and media (I do events promotion as a hobby so the page publishing is super useful for permanent linking of information).
My guess is that the wrench wasn’t implemented on small action posts on purpose because most sites would rather have staff be able to audit trail who has done what to a post, which makes sense. But I do think it could be useful in specific circumstances, maybe as an additional plugin.
It’s also my first time posting on this site . I think this is the right place for this request but apologies if not!
Permanent deletion is definitely the main one. I can’t personally think of a specific use case for changing the ownership of a small action, or the other admin options that are usually available on posts.
I can delete these messages through rails, but of course that involves finding the specific post ID and accessing the console so it would be a lot more convenient within the UI.
I’m somewhat familiar with component creation (not too familiar with plugin design yet but I do want to learn soon!). If I can get this working in a component - if that’s even possible - then I’ll definitely provide a GitHub link for the community!
필요하다면 p.raw.strip.downcase == "delete" 라인을 다른 키워드로 수정하여 이 키워드를 변경할 수 있습니다.
smalldelete.rb 스크립트
class TopicCleaner
def self.delete_small_actions(topic_id, dry_run: false)
topic = Topic.find_by(id: topic_id)
unless topic
puts "Topic #{topic_id} not found"
return
end
posts = topic.posts.where(post_type: Post.types[:small_action])
to_delete = posts.select { |p| p.raw.strip.downcase == "delete" }
if to_delete.empty?
puts "No small action posts with 'delete' found in topic #{topic_id}"
return
end
puts "Found #{to_delete.size} matching posts in topic ##{topic_id}"
to_delete.each do |post|
if dry_run
puts "Would PERMANENTLY delete post ##{post.id} (created #{post.created_at}, by #{post.user.username})"
else
post.destroy()
puts "🗑️ Permanently deleted post ##{post.id}"
end
end
puts dry_run ? "Dry run complete — no posts deleted." : "Finished permanent cleanup of topic #{topic_id}"
end
end
이 스크립트는 ID로 주제를 찾은 후, 해당 주제 내의 모든 게시물이 정의된 키워드만 포함하고 있는지 확인합니다. 조건이 충족되면 해당 특정 게시물을 삭제 대상으로 지정합니다.