mailboxer_multi_attach 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/app/models/messageable.rb +19 -4
- data/lib/mailboxer_multi_attach/version.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +24859 -0
- data/spec/integration/message_and_attachment_spec.rb +34 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7b85f69a2f2c2af4400c40b50f1b236940e8999
|
4
|
+
data.tar.gz: 931aaf518572598b1da048757ebd5182d8670e2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd53d46ae68cc450cb8a0103a67a38d71d1544951dae621a210d14b0ece5766144f46783e2651e2210af89e252fca5d7c7a2144cb7bdca3a54ec241e494b8be2
|
7
|
+
data.tar.gz: b5594dc111b9bf95e143072f567352b51b253be5375f564fcf221df63d9e4f704e75d8b98bc919851488dbe85b8163449e866f204c0a29adb92005007b288947
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -12,11 +12,12 @@ Add to your gemfile and run the following
|
|
12
12
|
|
13
13
|
## Usage
|
14
14
|
|
15
|
-
On any `messageable` object you utilize `send_message_mult_attach` or `
|
15
|
+
On any `messageable` object you utilize `send_message_mult_attach`, `reply_to_sender_mult_attach`, or `reply_to_convo_mult_attach` to send messages. Once the message is sent you can access the attachments by calling `message_attachments` on the messageable model's message. The following works where the entity has the `messageable` reference on its model. Make sure to use the key `:file` when submitting the attachment!
|
16
16
|
|
17
17
|
attachments = [{ :file => File.open('spec/testfile.txt') }, { :file => File.open('spec/1.mp4') }]
|
18
18
|
receipt = entity1.send_message_mult_attach(entity2, "Body", "Subject", true, attachments)
|
19
19
|
entity2.reply_to_sender_mult_attach(receipt, "Body", "Subject", true, attachments)
|
20
|
+
entity2.reply_to_convo_mult_attach(receipt.conversation, "Body", "Subject", true, attachments)
|
20
21
|
|
21
22
|
You can also not pass in attachments like the following.
|
22
23
|
|
data/app/models/messageable.rb
CHANGED
@@ -20,9 +20,8 @@ module Mailboxer
|
|
20
20
|
message.deliver false, sanitize_text
|
21
21
|
end
|
22
22
|
|
23
|
-
def reply(conversation, recipients,
|
24
|
-
|
25
|
-
attachment=nil)
|
23
|
+
def reply(conversation, recipients,
|
24
|
+
reply_body, subject=nil, sanitize_text=true)
|
26
25
|
subject = subject || "#{conversation.subject}"
|
27
26
|
build_message(conversation, recipients,
|
28
27
|
reply_body, subject,
|
@@ -37,6 +36,21 @@ module Mailboxer
|
|
37
36
|
message.deliver false, sanitize_text
|
38
37
|
end
|
39
38
|
|
39
|
+
def reply_to_convo_mult_attach(conversation, reply_body,
|
40
|
+
subject=nil, should_untrash=true,
|
41
|
+
sanitize_text=true, attachments=nil)
|
42
|
+
#move conversation to inbox if it is currently in the trash and should_untrash parameter is true.
|
43
|
+
if should_untrash && mailbox.is_trashed?(conversation)
|
44
|
+
mailbox.receipts_for(conversation).untrash
|
45
|
+
mailbox.receipts_for(conversation).mark_as_not_deleted
|
46
|
+
end
|
47
|
+
|
48
|
+
message = reply(conversation, conversation.last_message.recipients,
|
49
|
+
reply_body, subject, sanitize_text)
|
50
|
+
attach_files(attachments, message)
|
51
|
+
message.deliver false, sanitize_text
|
52
|
+
end
|
53
|
+
|
40
54
|
def build_convo(subject, message_timestamp)
|
41
55
|
::Mailboxer::ConversationBuilder.new(
|
42
56
|
subject: subject,
|
@@ -45,7 +59,8 @@ module Mailboxer
|
|
45
59
|
).build
|
46
60
|
end
|
47
61
|
|
48
|
-
def build_message(convo, recipients,
|
62
|
+
def build_message(convo, recipients,
|
63
|
+
msg_body, subject, message_timestamp)
|
49
64
|
::Mailboxer::MessageBuilder.new(
|
50
65
|
sender: self,
|
51
66
|
conversation: convo,
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|