Fix snippets API not working with visibility level
When a restricted visibility level of private is set in the instance,
creating a snippet with the visibility level would always fail.
This happened because:
-
params[:visibility]was a string (e.g. "public") -
CreateSnippetServiceandUpdateSnippetServiceonly looked atparams[:visibility_level], which wasnil.
To fix this, we:
- Make
CreateSnippetServicelook at the newly-builtsnippet.visibility_level, since the right value is assigned by theVisibilityLevel#visibility=method. - Modify
UpdateSnippetServiceto handle bothvisibility_levelandvisibilityparameters.
Edited by Stan Hu