diff options
author | Vinnie Okada <vokada@mrvinn.com> | 2015-03-10 18:21:09 -0600 |
---|---|---|
committer | Vinnie Okada <vokada@mrvinn.com> | 2015-03-10 18:36:43 -0600 |
commit | 9623b71a3975bb442b85aa57146b788f96de6320 (patch) | |
tree | 564e3e154a94b97cc839c7132fe4b4ac2027683d /lib | |
parent | 928fc94c3d900069902b097d6464acee712a886c (diff) | |
download | gitlab-ce-9623b71a3975bb442b85aa57146b788f96de6320.tar.gz |
More restricted visibility changes
Bug fixes and new tests for the restricted visibility changes.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/project_snippets.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/api/project_snippets.rb b/lib/api/project_snippets.rb index 25f34a3dab5..54f2555903f 100644 --- a/lib/api/project_snippets.rb +++ b/lib/api/project_snippets.rb @@ -51,13 +51,13 @@ module API attrs = attributes_for_keys [:title, :file_name, :visibility_level] attrs[:content] = params[:code] if params[:code].present? - @snippet = CreateSnippetservice.new(user_project, current_user, + @snippet = CreateSnippetService.new(user_project, current_user, attrs).execute - if @snippet.saved? - present @snippet, with: Entities::ProjectSnippet - else + if @snippet.errors.any? render_validation_error!(@snippet) + else + present @snippet, with: Entities::ProjectSnippet end end |