Skip to content

Commit 3f5b863

Browse files
author
Donny Wong
committed
updated code for improvement and fixes.
1 parent 9e06b9b commit 3f5b863

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

app/controllers/lti_deployments_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,12 @@ def check_host
183183

184184
def create_course
185185
if LtiConfig.respond_to?(:allowed_to_create_course?) && !LtiConfig.allowed_to_create_course?(record)
186+
@title = I18n.t('lti.course_creation_denied')
186187
@message = format(
187188
Settings.lti.unpermitted_new_course_message,
188189
course_name: record.lms_course_name
189190
)
190-
render 'unpermitted_course_creation', status: :unprocessable_entity
191+
render 'message', status: :forbidden
191192
return
192193
end
193194

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<section id='content'>
2-
<h1>Course Creation Not Allowed</h1>
2+
<h1><%= @title %></h1>
33
<p><%= @message %></p>
44
</section>

config/locales/common/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ en:
2222
help: Help
2323
lti:
2424
config_error: Error configuring LTI.
25+
course_creation_denied: Course Creation Not Allowed
2526
course_exists: A course with this name already exists on MarkUs. Please select a course to link to.
2627
course_link_error: Unsuccessful. Please relaunch MarkUs from your LMS.
2728
course_link_success: Success. %{markus_course_name} is now linked with your LMS.

config/settings/development.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ lti:
4242
course_filter_file: <%= "#{::Rails.root}/config/dummy_lti_config.rb" %>
4343
domains: <%= %w[host.docker.internal] %>
4444
token_endpoint: "http://host.docker.internal:3100/login/oauth2/token"
45-
unpermitted_new_course_message: 'You are not permitted to create a new MarkUs course for %{course_name}. If you are interested to use MarkUs for your course, please contact the MarkUs team at [email protected].'
45+
unpermitted_new_course_message: 'You are not permitted to create a new MarkUs course for %{course_name}. Please contact your system administrator.'
4646
sync_schedule: "0 3 * * *"

spec/controllers/lti_deployments_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151

152152
it 'responds with an error message' do
153153
post_as instructor, :create_course, params: course_params
154-
expect(response).to have_http_status(:unprocessable_entity)
154+
expect(response).to have_http_status(:forbidden)
155155
end
156156
end
157157
end

0 commit comments

Comments
 (0)