Skip to content

Commit

Permalink
Replaced 'config.action_controller.relative_url_root' with 'config.re…
Browse files Browse the repository at this point in the history
…lative_url_root' (#6595)
  • Loading branch information
DanielDervishi committed May 23, 2023
1 parent 99f6ce6 commit e0deb47
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/controllers/results_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def show
end

def edit
@host = Rails.application.config.action_controller.relative_url_root
@host = Rails.application.config.relative_url_root
@result = record
@submission = @result.submission
@grouping = @submission.grouping
Expand Down Expand Up @@ -536,7 +536,7 @@ def view_marks
end
@feedback_files = @submission.feedback_files

@host = Rails.application.config.action_controller.relative_url_root
@host = Rails.application.config.relative_url_root

m_logger = MarkusLogger.instance
m_logger.log("Student '#{current_role.user_name}' viewed results for assignment '#{@assignment.short_identifier}'.")
Expand Down
10 changes: 5 additions & 5 deletions app/helpers/automated_tests_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ def test_data(test_run_ids)
end

def get_markus_address(host_with_port)
if Rails.application.config.action_controller.relative_url_root.nil?
if Rails.application.config.relative_url_root.nil?
host_with_port
else
host_with_port + Rails.application.config.action_controller.relative_url_root
host_with_port + Rails.application.config.relative_url_root
end
end

# Sends RESTful api requests to the autotester
module AutotestApi
include AutomatedTestsHelper
AUTOTEST_USERNAME = "markus_#{Rails.application.config.action_controller.relative_url_root}".freeze
AUTOTEST_USERNAME = "markus_#{Rails.application.config.relative_url_root}".freeze

class LimitExceededException < StandardError; end
class UnauthorizedException < StandardError; end
Expand Down Expand Up @@ -298,10 +298,10 @@ def set_headers(req, api_key)

# Get the current URL for this MarkUs instance (adds the relative url root to +host_with_port+) if it exists.
def get_markus_address(host_with_port)
if Rails.application.config.action_controller.relative_url_root.nil?
if Rails.application.config.relative_url_root.nil?
host_with_port
else
host_with_port + Rails.application.config.action_controller.relative_url_root
host_with_port + Rails.application.config.relative_url_root
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/routing_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module RoutingHelper
def referer_options
referer_url = request.referer || ''
referer = URI(referer_url)
relative_url = Rails.application.config.action_controller.relative_url_root
relative_url = Rails.application.config.relative_url_root
referer.path = referer.path.gsub(%r{^#{relative_url}/?}, '/')
begin
options = Rails.application.routes.recognize_path(referer.to_s)
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/archive_submissions.rake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace :markus do
target_dir = Pathname.new(args[:target_dir])
raise "Directory #{target_dir} does not exist" unless Dir.exist?(target_dir)

relative_root = Rails.application.config.action_controller.relative_url_root
relative_root = Rails.application.config.relative_url_root
if relative_root
target_dir += relative_root
FileUtils.makedirs target_dir
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/autotest_run_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
end
include_examples 'autotest jobs'
let(:test_data) do
url_root = Rails.configuration.action_controller.relative_url_root
url_root = Rails.configuration.relative_url_root
groups.map do |group|
file_url = "http://localhost:3000#{url_root}/api/courses/#{assignment.course.id}/assignments/" \
"#{assignment.id}/groups/#{group.id}/submission_files?#{collected ? 'collected=true' : ''}"
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/autotest_specs_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
subject
end
it 'should set the body of the request' do
rel_url_root = Rails.configuration.action_controller.relative_url_root
rel_url_root = Rails.configuration.relative_url_root
file_url = "http://localhost:3000#{rel_url_root}/api/courses/#{assignment.course.id}/" \
"assignments/#{assignment.id}/test_files"
expect_any_instance_of(AutotestSpecsJob).to receive(:send_request!) do |_job, net_obj|
Expand Down

0 comments on commit e0deb47

Please sign in to comment.