chore: codeclimate fixes

This commit is contained in:
Sojan
2025-06-05 16:27:04 -05:00
parent 270fbe99ea
commit 3d27ae25c6
2 changed files with 15 additions and 7 deletions
+14 -4
View File
@@ -44,11 +44,8 @@ class Attachment < ApplicationRecord
def push_event_data
return unless file_type
return base_data.merge(location_metadata) if file_type.to_sym == :location
return base_data.merge(fallback_data) if file_type.to_sym == :fallback
return base_data.merge(contact_metadata) if file_type.to_sym == :contact
base_data.merge(file_metadata)
base_data.merge(metadata_for_file_type)
end
# NOTE: the URl returned does a 301 redirect to the actual file
@@ -76,6 +73,19 @@ class Attachment < ApplicationRecord
private
def metadata_for_file_type
case file_type.to_sym
when :location
location_metadata
when :fallback
fallback_data
when :contact
contact_metadata
else
file_metadata
end
end
def file_metadata
metadata = {
extension: extension,
@@ -50,9 +50,7 @@ class Captain::Conversation::ResponseBuilderJob < ApplicationJob
def message_content(message)
return message.content if message.content.present?
return 'User has shared an attachment' if message.attachments.any?
'User has shared a message without content'
message.attachments.any? ? 'User has shared an attachment' : 'User has shared a message without content'
end
def determine_role(message)