Commit 9623b71a authored by Vinnie Okada's avatar Vinnie Okada

More restricted visibility changes

Bug fixes and new tests for the restricted visibility changes.
parent 928fc94c
...@@ -29,7 +29,8 @@ module ApplicationSettingsHelper ...@@ -29,7 +29,8 @@ module ApplicationSettingsHelper
checkbox_name = 'application_setting[restricted_visibility_levels][]' checkbox_name = 'application_setting[restricted_visibility_levels][]'
label_tag(checkbox_name, class: css_class) do label_tag(checkbox_name, class: css_class) do
check_box_tag(checkbox_name, level, checked, autocomplete: 'off', check_box_tag(checkbox_name, level, checked,
autocomplete: 'off',
'aria-describedby' => help_block_id) + name 'aria-describedby' => help_block_id) + name
end end
end end
......
...@@ -51,13 +51,13 @@ module API ...@@ -51,13 +51,13 @@ module API
attrs = attributes_for_keys [:title, :file_name, :visibility_level] attrs = attributes_for_keys [:title, :file_name, :visibility_level]
attrs[:content] = params[:code] if params[:code].present? attrs[:content] = params[:code] if params[:code].present?
@snippet = CreateSnippetservice.new(user_project, current_user, @snippet = CreateSnippetService.new(user_project, current_user,
attrs).execute attrs).execute
if @snippet.saved? if @snippet.errors.any?
present @snippet, with: Entities::ProjectSnippet
else
render_validation_error!(@snippet) render_validation_error!(@snippet)
else
present @snippet, with: Entities::ProjectSnippet
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment