diff --git a/app/controllers/label_templates_controller.rb b/app/controllers/label_templates_controller.rb index fbdbecbcf..cbc13c7c6 100644 --- a/app/controllers/label_templates_controller.rb +++ b/app/controllers/label_templates_controller.rb @@ -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 diff --git a/app/models/label_template.rb b/app/models/label_template.rb index 1346ac246..21526f31d 100644 --- a/app/models/label_template.rb +++ b/app/models/label_template.rb @@ -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