mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-09 00:00:12 +09:00
ce4c05da81
Administrators see banned users in the account settings, but only the first page counted them: the next pages listed active users alone. A banned member before the page boundary shifted the offset, so one active member was never listed. Both pages now share User.visible_to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0142qgjggdJ2KDdGk7RF9Xm9
27 lines
639 B
Ruby
27 lines
639 B
Ruby
class Accounts::UsersController < ApplicationController
|
|
before_action :ensure_can_administer, :set_user, only: %i[ update destroy ]
|
|
|
|
def index
|
|
set_page_and_extract_portion_from User.visible_to(Current.user).ordered.member, per_page: 500
|
|
end
|
|
|
|
def update
|
|
@user.update(role_params)
|
|
redirect_to edit_account_url
|
|
end
|
|
|
|
def destroy
|
|
@user.deactivate
|
|
redirect_to edit_account_url
|
|
end
|
|
|
|
private
|
|
def set_user
|
|
@user = User.active.find(params[:user_id] || params[:id])
|
|
end
|
|
|
|
def role_params
|
|
{ role: params.require(:user)[:role].presence_in(%w[ member administrator ]) || "member" }
|
|
end
|
|
end
|