Skip to content

Fixes #38653 - Fix settings show endpoint #10644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/controllers/api/v2/settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ class SettingsController < V2::BaseController

before_action :find_resource, :only => %w{show update}

def find_resource
@setting = resource_scope.find(params[:id])
raise ActiveRecord::RecordNotFound if @setting.nil?
end

def_param_group :setting_params do
property :id, String, desc: N_('Alias for setting name')
property :name, String, desc: N_('Setting unique name')
Expand Down
5 changes: 5 additions & 0 deletions test/controllers/api/v2/settings_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ def setup
show_response = ActiveSupport::JSON.decode(@response.body)
assert_include show_response.keys, 'updated_at'
end

test "return 404 for non-existent setting" do
get :show, params: { :id => 'non_existent_setting' }
assert_response :not_found
end
end

test "should not update setting" do
Expand Down