mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 11:11:11 +02:00
* [Glitch] Fix undefined `current_flavour` in controllers After the theming infrastructure migration (#37612, #37807), `ThemingConcern` was removed and theme-related methods were moved to `ThemeHelper`. However, controllers like `Settings::FlavoursController` call `current_flavour` directly in their actions, which is not accessible from a view helper module. Include `ThemeHelper` in `ApplicationController` to restore access to `current_flavour`, `current_skin`, `current_theme`, and other theme methods in all controllers. Co-authored-by: Cursor <cursoragent@cursor.com> * Include ThemeHelper in Settings::FlavoursController instead of ApplicationController --------- Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
750 B
Ruby
29 lines
750 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Settings::FlavoursController < Settings::BaseController
|
|
include ThemeHelper
|
|
|
|
layout 'admin'
|
|
|
|
before_action :authenticate_user!
|
|
|
|
skip_before_action :require_functional!
|
|
|
|
def index
|
|
redirect_to action: 'show', flavour: current_flavour
|
|
end
|
|
|
|
def show
|
|
redirect_to action: 'show', flavour: current_flavour unless Themes.instance.flavours.include?(params[:flavour]) || (params[:flavour] == current_flavour)
|
|
|
|
@listing = Themes.instance.flavours
|
|
@selected = params[:flavour]
|
|
end
|
|
|
|
def update
|
|
current_user.settings.update(flavour: params.require(:flavour), skin: params.dig(:user, :setting_skin))
|
|
current_user.save
|
|
redirect_to action: 'show', flavour: params[:flavour]
|
|
end
|
|
end
|