Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
50 lines
1.5 KiB
Ruby
50 lines
1.5 KiB
Ruby
class CsatTemplateNameService
|
|
CSAT_BASE_NAME = 'customer_satisfaction_survey'.freeze
|
|
|
|
# Generates template names like: customer_satisfaction_survey_{inbox_id}_{version_number}
|
|
|
|
def self.csat_template_name(inbox_id, version = nil)
|
|
base_name = csat_base_name_for_inbox(inbox_id)
|
|
version ? "#{base_name}_#{version}" : base_name
|
|
end
|
|
|
|
def self.extract_version(template_name, inbox_id)
|
|
return nil if template_name.blank?
|
|
|
|
pattern = versioned_pattern_for_inbox(inbox_id)
|
|
match = template_name.match(pattern)
|
|
match ? match[1].to_i : nil
|
|
end
|
|
|
|
def self.generate_next_template_name(base_name, inbox_id, current_template_name)
|
|
return base_name if current_template_name.blank?
|
|
|
|
current_version = extract_version(current_template_name, inbox_id)
|
|
next_version = current_version ? current_version + 1 : 1
|
|
csat_template_name(inbox_id, next_version)
|
|
end
|
|
|
|
def self.matches_csat_pattern?(template_name, inbox_id)
|
|
return false if template_name.blank?
|
|
|
|
base_pattern = base_pattern_for_inbox(inbox_id)
|
|
versioned_pattern = versioned_pattern_for_inbox(inbox_id)
|
|
|
|
template_name.match?(base_pattern) || template_name.match?(versioned_pattern)
|
|
end
|
|
|
|
def self.csat_base_name_for_inbox(inbox_id)
|
|
"#{CSAT_BASE_NAME}_#{inbox_id}"
|
|
end
|
|
|
|
def self.base_pattern_for_inbox(inbox_id)
|
|
/^#{CSAT_BASE_NAME}_#{inbox_id}$/
|
|
end
|
|
|
|
def self.versioned_pattern_for_inbox(inbox_id)
|
|
/^#{CSAT_BASE_NAME}_#{inbox_id}_(\d+)$/
|
|
end
|
|
|
|
private_class_method :csat_base_name_for_inbox, :base_pattern_for_inbox, :versioned_pattern_for_inbox
|
|
end
|