How to remove admin logs

Potresti farlo usando la console di Rails ma è anche pericoloso. Quindi, se ho capito bene, sarebbe così:

cd /var/discourse

sudo ./launcher enter app

rails c

Ora sei nella console, un’opzione per eliminare l’intera azione dello staff / i log dell’amministratore è usare questo:

Tuttavia, questo rimuove tutto, il che potrebbe non essere quello che volevi. Potresti voler limitare il periodo di tempo o indagare su determinate azioni.

Ad esempio:
UserHistory.where(action: 17, acting_user_id: 5)

Questo restituirebbe tutti i post eliminati dall’utente con ID 5

oppure

UserHistory.where(action: 17, post_id: 15643)

Questo restituirebbe informazioni su chi ha eliminato il post con ID 15643

Per un elenco dei campi della tabella e degli ID delle azioni, consulta questo file:

# == Schema Information
#
# Table name: user_histories
#
#  id             :integer          not null, primary key
#  action         :integer          not null
#  acting_user_id :integer
#  target_user_id :integer
#  details        :text
#  created_at     :datetime         not null
#  updated_at     :datetime         not null
#  context        :string
#  ip_address     :string
#  email          :string
#  subject        :text
#  previous_value :text
#  new_value      :text
#  topic_id       :integer
#  admin_only     :boolean          default(FALSE)
#  post_id        :integer
#  custom_type    :string
#  category_id    :integer
#
# Indexes
#
#  index_user_histories_on_acting_user_id_and_action_and_id        (acting_user_id,action,id)
#  index_user_histories_on_action_and_id                           (action,id)
#  index_user_histories_on_category_id                             (category_id)
#  index_user_histories_on_subject_and_id                          (subject,id)
#  index_user_histories_on_target_user_id_and_id                   (target_user_id,id)
#  index_user_histories_on_topic_id_and_target_user_id_and_action  (topic_id,target_user_id,action)
#