fix: Update location component to avoid overflow, handle location title from Telegram payload (#9113)
Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
@@ -130,6 +130,7 @@ class Telegram::IncomingMessageService
|
||||
@message.attachments.new(
|
||||
account_id: @message.account_id,
|
||||
file_type: :location,
|
||||
fallback_title: location_fallback_title,
|
||||
coordinates_lat: location['latitude'],
|
||||
coordinates_long: location['longitude']
|
||||
)
|
||||
@@ -139,6 +140,16 @@ class Telegram::IncomingMessageService
|
||||
@file ||= visual_media_params || params[:message][:voice].presence || params[:message][:audio].presence || params[:message][:document].presence
|
||||
end
|
||||
|
||||
def location_fallback_title
|
||||
return '' if venue.blank?
|
||||
|
||||
venue[:title] || ''
|
||||
end
|
||||
|
||||
def venue
|
||||
@venue ||= params.dig(:message, :venue).presence
|
||||
end
|
||||
|
||||
def location
|
||||
@location ||= params.dig(:message, :location).presence
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user