FIX: don't error out when deleting a topic with no user

This commit is contained in:
Régis Hanol 2016-06-15 14:41:08 +02:00
parent bf64280661
commit ed4634dc34

View File

@ -65,10 +65,12 @@ class StaffActionLogger
def log_topic_deletion(deleted_topic, opts={})
raise Discourse::InvalidParameters.new(:deleted_topic) unless deleted_topic && deleted_topic.is_a?(Topic)
user = delete_topic.user ? "#{deleted_topic.user.username} (#{deleted_topic.user.name})" : "(deleted user)"
details = [
"id: #{deleted_topic.id}",
"created_at: #{deleted_topic.created_at}",
"user: #{deleted_topic.user.username} (#{deleted_topic.user.name})",
"user: #{user}",
"title: #{deleted_topic.title}"
]