Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Refactor Api::Web::SettingsController (mastodon#15717)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored Feb 12, 2021
1 parent f8972d4 commit 15ced87
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/controllers/api/web/settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

class Api::Web::SettingsController < Api::Web::BaseController
before_action :require_user!
before_action :set_setting

def update
setting.data = params[:data]
setting.save!

@setting.update!(data: params[:data])
render_empty
end

private

def setting
@_setting ||= ::Web::Setting.where(user: current_user).first_or_initialize(user: current_user)
def set_setting
@setting = ::Web::Setting.where(user: current_user).first_or_initialize(user: current_user)
end
end

0 comments on commit 15ced87

Please sign in to comment.