Skip to content

Commit

Permalink
Use existing global variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ncounter committed Mar 22, 2024
1 parent 45ad4ec commit 323a5f1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/api/app/controllers/webui/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ class Webui::RequestController < Webui::WebuiController
before_action :require_request,
only: %i[changerequest show request_action request_action_changes inline_comment build_results rpm_lint
changes mentioned_issues chart_build_results complete_build_results]
before_action :set_actions, only: %i[inline_comment show build_results rpm_lint changes mentioned_issues chart_build_results complete_build_results],
before_action :set_actions, only: %i[inline_comment show build_results rpm_lint changes mentioned_issues chart_build_results complete_build_results request_action_changes],
if: -> { Flipper.enabled?(:request_show_redesign, User.session) }
before_action :set_actions, only: [:show]
before_action :build_results_data, only: [:show], if: -> { Flipper.enabled?(:request_show_redesign, User.session) }
before_action :set_supported_actions, only: %i[inline_comment show build_results rpm_lint changes mentioned_issues],
if: -> { Flipper.enabled?(:request_show_redesign, User.session) }
Expand Down Expand Up @@ -176,7 +177,7 @@ def request_action
end

def request_action_changes
@action = @bs_request.bs_request_actions.where(id: params['id'].to_i).first
@action = @actions.where(id: params['id'].to_i).first

Check warning on line 180 in src/api/app/controllers/webui/request_controller.rb

View check run for this annotation

Codecov / codecov/patch

src/api/app/controllers/webui/request_controller.rb#L180

Added line #L180 was not covered by tests

cache_diff_data

Expand Down Expand Up @@ -342,7 +343,7 @@ def addreview_opts
end

def any_project_maintained_by_current_user?
projects = @bs_request.bs_request_actions.select(:target_project).distinct.pluck(:target_project)
projects = @actions.select(:target_project).distinct.pluck(:target_project)
maintainer_role = Role.find_by_title('maintainer')
projects.any? { |project| Project.find_by_name(project).user_has_role?(User.possibly_nobody, maintainer_role) }
end
Expand Down Expand Up @@ -371,7 +372,7 @@ def require_request
end

def target_package_maintainers
distinct_bs_request_actions = @bs_request.bs_request_actions.select(:target_project, :target_package).distinct
distinct_bs_request_actions = @actions.select(:target_project, :target_package).distinct
distinct_bs_request_actions.flat_map do |action|
Package.find_by_project_and_name(action.target_project, action.target_package).try(:maintainers)
end.compact.uniq
Expand Down Expand Up @@ -524,7 +525,7 @@ def prepare_request_data
@diff_to_superseded_id = params[:diff_to_superseded]

# Handling request actions
@action ||= @bs_request.bs_request_actions.first
@action ||= @actions.first
action_index = @supported_actions.index(@action)
if action_index
@prev_action = @supported_actions[action_index - 1] unless action_index.zero?
Expand Down

0 comments on commit 323a5f1

Please sign in to comment.