The code powering m.abunchtell.com https://m.abunchtell.com
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 

51 rader
1.4 KiB

  1. # frozen_string_literal: true
  2. module Admin
  3. class AccountsController < BaseController
  4. before_action :set_account, except: :index
  5. def index
  6. @accounts = Account.alphabetic.page(params[:page])
  7. @accounts = @accounts.local if params[:local].present?
  8. @accounts = @accounts.remote if params[:remote].present?
  9. @accounts = @accounts.where(domain: params[:by_domain]) if params[:by_domain].present?
  10. @accounts = @accounts.silenced if params[:silenced].present?
  11. @accounts = @accounts.recent if params[:recent].present?
  12. @accounts = @accounts.suspended if params[:suspended].present?
  13. end
  14. def show; end
  15. def suspend
  16. Admin::SuspensionWorker.perform_async(@account.id)
  17. redirect_to admin_accounts_path
  18. end
  19. def unsuspend
  20. @account.update(suspended: false)
  21. redirect_to admin_accounts_path
  22. end
  23. def silence
  24. @account.update(silenced: true)
  25. redirect_to admin_accounts_path
  26. end
  27. def unsilence
  28. @account.update(silenced: false)
  29. redirect_to admin_accounts_path
  30. end
  31. private
  32. def set_account
  33. @account = Account.find(params[:id])
  34. end
  35. def account_params
  36. params.require(:account).permit(:silenced, :suspended)
  37. end
  38. end
  39. end