Class: WarningTemplate

Inherits:
ApplicationRecord show all
Includes:
CommunityRelated
Defined in:
app/models/warning_template.rb

Instance Method Summary collapse

Methods inherited from ApplicationRecord

#attributes_print, fuzzy_search, match_search, #match_search, sanitize_for_search, sanitize_name, sanitize_sql_in, useful_err_msg, with_lax_group_rules

Instance Method Details

#body_as_b64Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/models/warning_template.rb', line 8

def body_as_b64
  body_with_site_replacements = body.gsub '$SiteName', SiteSetting['SiteName']

  chat_link = if SiteSetting['ChatLink'].nil?
                'chat'
              else
                "[chat](#{SiteSetting['ChatLink']})"
              end
  body_with_site_replacements = body_with_site_replacements.gsub '$ChatLink', chat_link

  Base64.encode64(body_with_site_replacements)
end