Show only default label templates when feature is disabled [SCI-9028]

This commit is contained in:
Oleksii Kriuchykhin 2023-08-17 13:44:22 +02:00
parent 0082b858ec
commit 14e49956f7
2 changed files with 3 additions and 1 deletions

View file

@ -174,7 +174,7 @@ class LabelTemplatesController < ApplicationController
end
def load_label_templates
@label_templates = LabelTemplate.where(team_id: current_team.id)
@label_templates = LabelTemplate.enabled? ? current_team.label_templates : current_team.label_templates.default
end
def load_label_template

View file

@ -15,6 +15,8 @@ class LabelTemplate < ApplicationRecord
validate :ensure_single_default_template!
scope :default, -> { where(default: true) }
def self.enabled?
ApplicationSettings.instance.values['label_templates_enabled'] == true
end