mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-08 07:40:08 +09:00
f864403c2c
Since administrators were grouped apart from members (b52c318), the account
settings page loads every user to split them and renders all of them. The
lazy next page still starts at the 501st user, so on an account with more
than 500 people, scrolling down lists those users a second time.
Load administrators on their own and page only members, both on the settings
page and on the pages that follow it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0142qgjggdJ2KDdGk7RF9Xm9
33 lines
730 B
Ruby
33 lines
730 B
Ruby
class AccountsController < ApplicationController
|
|
before_action :ensure_can_administer, only: :update
|
|
before_action :set_account
|
|
|
|
def edit
|
|
users = account_users.ordered
|
|
@administrators = users.administrator
|
|
set_page_and_extract_portion_from users.member, per_page: 500
|
|
end
|
|
|
|
def update
|
|
@account.update!(account_params)
|
|
redirect_to edit_account_url, notice: "✓"
|
|
end
|
|
|
|
private
|
|
def set_account
|
|
@account = Current.account
|
|
end
|
|
|
|
def account_params
|
|
params.require(:account).permit(:name, :logo, settings: {})
|
|
end
|
|
|
|
def account_users
|
|
if Current.user.can_administer?
|
|
User.where(status: [ :active, :banned ])
|
|
else
|
|
User.active
|
|
end
|
|
end
|
|
end
|