Feature: Support file type messages on widget and dashboard (#659)
- Adds support for file upload Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com> Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
committed by
GitHub
parent
0afa5c297f
commit
7fcd2d0e85
@@ -1,4 +1,5 @@
|
||||
class Messages::Outgoing::NormalBuilder
|
||||
include ::FileTypeHelper
|
||||
attr_reader :message
|
||||
|
||||
def initialize(user, conversation, params)
|
||||
@@ -13,7 +14,10 @@ class Messages::Outgoing::NormalBuilder
|
||||
def perform
|
||||
@message = @conversation.messages.build(message_params)
|
||||
if @attachment
|
||||
@message.attachment = Attachment.new(account_id: message.account_id)
|
||||
@message.attachment = Attachment.new(
|
||||
account_id: message.account_id,
|
||||
file_type: file_type(@attachment[:file]&.content_type)
|
||||
)
|
||||
@message.attachment.file.attach(@attachment[:file])
|
||||
end
|
||||
@message.save
|
||||
|
||||
Reference in New Issue
Block a user