feat: Add support for template variables in messages content (#6215)

Fixes: #6078

Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
Muhsin Keloth
2023-01-10 16:00:34 +05:30
committed by GitHub
parent e7a52c3a46
commit 078ff615ee
8 changed files with 177 additions and 0 deletions

17
app/drops/contact_drop.rb Normal file
View File

@@ -0,0 +1,17 @@
class ContactDrop < BaseDrop
def email
@obj.try(:email)
end
def phone_number
@obj.try(:phone_number)
end
def first_name
@obj.try(:name).try(:split).try(:first)
end
def last_name
@obj.try(:name).try(:split).try(:last) if @obj.try(:name).try(:split).try(:size) > 1
end
end

View File

@@ -2,4 +2,12 @@ class UserDrop < BaseDrop
def available_name
@obj.try(:available_name)
end
def first_name
@obj.try(:name).try(:split).try(:first)
end
def last_name
@obj.try(:name).try(:split).try(:last) if @obj.try(:name).try(:split).try(:size) > 1
end
end