diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/admin/action_logs_helper.rb | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/app/helpers/admin/action_logs_helper.rb b/app/helpers/admin/action_logs_helper.rb index 359d60b60..e5fbb1500 100644 --- a/app/helpers/admin/action_logs_helper.rb +++ b/app/helpers/admin/action_logs_helper.rb @@ -9,42 +9,6 @@ module Admin::ActionLogsHelper end end - def linkable_log_target(record) - case record.class.name - when 'Account' - link_to record.acct, admin_account_path(record.id) - when 'User' - link_to record.account.acct, admin_account_path(record.account_id) - when 'CustomEmoji' - record.shortcode - when 'Report' - link_to "##{record.id}", admin_report_path(record) - when 'DomainBlock', 'EmailDomainBlock' - link_to record.domain, "https://#{record.domain}" - when 'Status' - link_to record.account.acct, TagManager.instance.url_for(record) - when 'AccountWarning' - link_to record.target_account.acct, admin_account_path(record.target_account_id) - end - end - - def log_target_from_history(type, attributes) - case type - when 'CustomEmoji' - attributes['shortcode'] - when 'DomainBlock', 'EmailDomainBlock' - link_to attributes['domain'], "https://#{attributes['domain']}" - when 'Status' - tmp_status = Status.new(attributes.except('reblogs_count', 'favourites_count')) - - if tmp_status.account - link_to tmp_status.account&.acct || "##{tmp_status.account_id}", admin_account_path(tmp_status.account_id) - else - I18n.t('admin.action_logs.deleted_status') - end - end - end - def relevant_log_changes(log) if log.target_type == 'CustomEmoji' && [:enable, :disable, :destroy].include?(log.action) log.recorded_changes.slice('domain') @@ -111,4 +75,40 @@ module Admin::ActionLogsHelper def opposite_verbs?(log) %w(DomainBlock EmailDomainBlock AccountWarning).include?(log.target_type) end + + def linkable_log_target(record) + case record.class.name + when 'Account' + link_to record.acct, admin_account_path(record.id) + when 'User' + link_to record.account.acct, admin_account_path(record.account_id) + when 'CustomEmoji' + record.shortcode + when 'Report' + link_to "##{record.id}", admin_report_path(record) + when 'DomainBlock', 'EmailDomainBlock' + link_to record.domain, "https://#{record.domain}" + when 'Status' + link_to record.account.acct, TagManager.instance.url_for(record) + when 'AccountWarning' + link_to record.target_account.acct, admin_account_path(record.target_account_id) + end + end + + def log_target_from_history(type, attributes) + case type + when 'CustomEmoji' + attributes['shortcode'] + when 'DomainBlock', 'EmailDomainBlock' + link_to attributes['domain'], "https://#{attributes['domain']}" + when 'Status' + tmp_status = Status.new(attributes.except('reblogs_count', 'favourites_count')) + + if tmp_status.account + link_to tmp_status.account&.acct || "##{tmp_status.account_id}", admin_account_path(tmp_status.account_id) + else + I18n.t('admin.action_logs.deleted_status') + end + end + end end |