hackatime/app/controllers/settings/integrations_controller.rb
Mahad Kalam 42ceec73cb
Upgrade Inertia + new settings page (#950)
* New settings?

* New Settings page!

* Vendor Inertia

* Fix some issues

* <Link>ify the site!
2026-02-15 17:32:26 +00:00

30 lines
887 B
Ruby

class Settings::IntegrationsController < Settings::BaseController
def show
render_integrations
end
def update
if @user.update(integrations_params)
@user.update_slack_status if @user.uses_slack_status?
PosthogService.capture(@user, "settings_updated", { fields: integrations_params.keys })
redirect_to my_settings_integrations_path, notice: "Settings updated successfully"
else
flash.now[:error] = @user.errors.full_messages.to_sentence.presence || "Failed to update settings"
render_integrations(status: :unprocessable_entity)
end
end
private
def render_integrations(status: :ok)
render_settings_page(
active_section: "integrations",
settings_update_path: my_settings_integrations_path,
status: status
)
end
def integrations_params
params.require(:user).permit(:uses_slack_status)
end
end