extract email assets

This commit is contained in:
Pete Matsyburka
2026-06-29 12:30:10 +03:00
parent 065dcf6f9f
commit 6ed5b5d35d
8 changed files with 127 additions and 6 deletions
+9
View File
@@ -33,6 +33,15 @@ class EmailMessage < ApplicationRecord
before_validation :set_sha1, on: :create
def normalized_body
@normalized_body ||=
if body&.include?(EmailMessages::ASSET_PREFIX)
EmailMessages.rebuild_body_with_assets(account_id, body)
else
body
end
end
def set_sha1
self.sha1 = Digest::SHA1.hexdigest({ subject:, body: }.to_json)
end