Class: NewsmastMastodon::Api::V1::Patchwork::AlttextSettingsController

Inherits:
Api::BaseController
  • Object
show all
Includes:
Concerns::ApiResponseHelper
Defined in:
app/controllers/newsmast_mastodon/api/v1/patchwork/alttext_settings_controller.rb

Instance Method Summary collapse

Instance Method Details

#change_alttext_settingObject



14
15
16
17
18
19
20
# File 'app/controllers/newsmast_mastodon/api/v1/patchwork/alttext_settings_controller.rb', line 14

def change_alttext_setting
  if current_user.update(alttext_enabled: enable_alttext_setting)
    render_success(current_user.alttext_enabled, "api.messages.success", :ok)
  else
    render_error("api.errors.unprocessable_entity", :unprocessable_entity)
  end
end

#indexObject



10
11
12
# File 'app/controllers/newsmast_mastodon/api/v1/patchwork/alttext_settings_controller.rb', line 10

def index
  render_success(current_user.alttext_enabled, "api.messages.success", :ok)
end