(Hotfix) Fixes a variety of small bugs (#115)

* Remove ap call

* Fix remix render method

* Downcase username on db end

There was a bug where users with capital letters in their name could not access their profiles after we tried to make things case insensitive.

* Remove ap call and unused code
This commit is contained in:
Justin Edmund 2023-07-04 03:21:02 -07:00 committed by GitHub
parent 78b5b063fc
commit 13a9644bb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 18 deletions

View file

@ -23,19 +23,6 @@ module Api
party.user = current_user if current_user
party.attributes = party_params if party_params
# unless party_params.empty?
# party.attributes = party_params
#
# # TODO: Extract this into a different method
# job = Job.find(party_params['job_id']) if party_params['job_id'].present?
# if job
# job_skills = JobSkill.where(job: job.id, main: true)
# job_skills.each_with_index do |skill, index|
# party["skill#{index}_id"] = skill.id
# end
# end
# end
if party.save!
return render json: PartyBlueprint.render(party, view: :created, root: :party),
status: :created
@ -76,8 +63,8 @@ module Api
new_party.local_id = party_params[:local_id] if !party_params.nil?
if new_party.save
render json: PartyBlueprint.render(new_party, view: :created, root: :party,
meta: { remix: true })
render json: PartyBlueprint.render(new_party, view: :created, root: :party),
status: :created
else
render_validation_error_response(new_party)
end

View file

@ -167,11 +167,11 @@ module Api
# Specify whitelisted properties that can be modified.
def set
@user = User.where('username = ?', params[:id].downcase).first
@user = User.find_by('lower(username) = ?', params[:id].downcase)
end
def set_by_id
@user = User.where('id = ?', params[:id]).first
@user = User.find_by('id = ?', params[:id])
end
def user_params

View file

@ -20,7 +20,6 @@ module Api
end
def to_hash
ap @data
{
message: message,
code: code,