about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-11-06 09:50:41 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-11-06 09:50:41 +0100
commit0ad919b19257b7d8eb447f7955030927d26cdbe6 (patch)
treed78bd5ba447da166bb7d97a3df3e6d97902a5cdb /app/helpers
parent2f8fb49d1314db931385089bc9004a48700161ad (diff)
parent5187e4e758b0636432d984d1a95a310cac536205 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `app/javascript/mastodon/features/compose/components/poll_form.js`:
  glitch-soc change because of having changed the default number of
  available poll options.
  Applied upstream's changes while keeping glitch-soc's default number of
  poll options.
- `public/oops.png`:
  We had a minor graphics change, probably not worth diverging from upstream.
  Took upstream version.
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/admin/action_logs_helper.rb20
-rw-r--r--app/helpers/application_helper.rb7
2 files changed, 20 insertions, 7 deletions
diff --git a/app/helpers/admin/action_logs_helper.rb b/app/helpers/admin/action_logs_helper.rb
index fd1977ac5..215ecea0d 100644
--- a/app/helpers/admin/action_logs_helper.rb
+++ b/app/helpers/admin/action_logs_helper.rb
@@ -4,15 +4,19 @@ module Admin::ActionLogsHelper
   def log_target(log)
     case log.target_type
     when 'Account'
-      link_to log.human_identifier, admin_account_path(log.target_id)
+      link_to (log.human_identifier.presence || I18n.t('admin.action_logs.deleted_account')), admin_account_path(log.target_id)
     when 'User'
-      link_to log.human_identifier, admin_account_path(log.route_param)
+      if log.route_param.present?
+        link_to log.human_identifier, admin_account_path(log.route_param)
+      else
+        I18n.t('admin.action_logs.deleted_account')
+      end
     when 'UserRole'
       link_to log.human_identifier, admin_roles_path(log.target_id)
     when 'Report'
-      link_to "##{log.human_identifier}", admin_report_path(log.target_id)
+      link_to "##{log.human_identifier.presence || log.target_id}", admin_report_path(log.target_id)
     when 'DomainBlock', 'DomainAllow', 'EmailDomainBlock', 'UnavailableDomain'
-      link_to log.human_identifier, "https://#{log.human_identifier}"
+      link_to log.human_identifier, "https://#{log.human_identifier.presence}"
     when 'Status'
       link_to log.human_identifier, log.permalink
     when 'AccountWarning'
@@ -22,9 +26,13 @@ module Admin::ActionLogsHelper
     when 'IpBlock', 'Instance', 'CustomEmoji'
       log.human_identifier
     when 'CanonicalEmailBlock'
-      content_tag(:samp, log.human_identifier[0...7], title: log.human_identifier)
+      content_tag(:samp, (log.human_identifier.presence || '')[0...7], title: log.human_identifier)
     when 'Appeal'
-      link_to log.human_identifier, disputes_strike_path(log.route_param)
+      if log.route_param.present?
+        link_to log.human_identifier, disputes_strike_path(log.route_param.presence)
+      else
+        I18n.t('admin.action_logs.deleted_account')
+      end
     end
   end
 end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c5374a195..af453825b 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -204,7 +204,7 @@ module ApplicationHelper
     permit_visibilities.shift(permit_visibilities.index(default_privacy) + 1) if default_privacy.present?
     state_params[:visibility] = params[:visibility] if permit_visibilities.include? params[:visibility]
 
-    if user_signed_in?
+    if user_signed_in? && current_user.functional?
       state_params[:settings]          = state_params[:settings].merge(Web::Setting.find_by(user: current_user)&.data || {})
       state_params[:push_subscription] = current_account.user.web_push_subscription(current_session)
       state_params[:current_account]   = current_account
@@ -212,6 +212,11 @@ module ApplicationHelper
       state_params[:admin]             = Account.find_local(Setting.site_contact_username.strip.gsub(/\A@/, ''))
     end
 
+    if user_signed_in? && !current_user.functional?
+      state_params[:disabled_account] = current_account
+      state_params[:moved_to_account] = current_account.moved_to_account
+    end
+
     if single_user_mode?
       state_params[:owner] = Account.local.without_suspended.where('id > 0').first
     end