extract email assets

This commit is contained in:
Pete Matsyburka committed 2026-06-29 13:21:03 +03:00
1 parent 065dcf6f9f
commit 6ed5b5d35d
8 files changed
+127 -6

No files matched your search

+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