Skip to content

Commit

Permalink
houndbot refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
Tooyosi committed Feb 15, 2024
1 parent 1e19b56 commit df45cce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/controllers/api/v1/project_preferences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,19 @@ def update_settings
)
end

def find_upp
def fetch_upp_list
if action_name == 'read_settings'
@upp_list = UserProjectPreference.where(project_id: params[:project_id]).where.not(email_communication: nil)
@upp_list = @upp_list.where(user_id: params[:user_id]) if params[:user_id].present?
else
@upp_list = UserProjectPreference.where(user_id: params_for[:user_id], project_id: params_for[:project_id])
end
end

def find_upp
fetch_upp_list
@upp = @upp_list.first
raise ActiveRecord::RecordNotFound unless !@upp.blank?
raise ActiveRecord::RecordNotFound unless @upp.present?

raise Api::Unauthorized, 'You must be the project owner or a collaborator' unless user_allowed?
end
Expand Down

0 comments on commit df45cce

Please sign in to comment.