Skip to content

Commit

Permalink
Normalize account login parameter to lowercase in accounts controller
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Dec 7, 2024
1 parent 7a356e8 commit e9a3eed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def index
end

def show
@account = Account.find_by_login(params[:id])
@account = Account.find_by_login(params[:id].downcase)
end

def sponsors
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/v1/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def index
end

def show
@account = Account.find_by_login(params[:id])
@account = Account.find_by_login(params[:id].downcase)
raise ActiveRecord::RecordNotFound unless @account
end

Expand All @@ -16,15 +16,15 @@ def sponsors
end

def sponsorships
@account = Account.find_by_login(params[:account_id])
@account = Account.find_by_login(params[:account_id].downcase)
raise ActiveRecord::RecordNotFound unless @account
scope = @account.sponsorships_as_maintainer.order('created_at DESC').includes(:maintainer, :funder)
@pagy, @sponsorships = pagy(scope)
render 'api/v1/sponsorships/index'
end

def account_sponsors
@account = Account.find_by_login(params[:account_id])
@account = Account.find_by_login(params[:account_id].downcase)
raise ActiveRecord::RecordNotFound unless @account
scope = @account.sponsorships_as_funder.order('created_at DESC').includes(:maintainer, :funder)
@pagy, @sponsorships = pagy(scope)
Expand Down

0 comments on commit e9a3eed

Please sign in to comment.