Skip to content

Commit

Permalink
Add message_id to the payload format of ImapFolderAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
knu committed Aug 3, 2017
1 parent d9309b9 commit 734b84d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/agents/imap_folder_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class ImapFolderAgent < Agent
Events look like this:
{
"message_id": "...(Message-Id without angle brackets)...",
"folder": "INBOX",
"subject": "...",
"from": "Nanashi <[email protected]>",
Expand Down Expand Up @@ -265,6 +266,7 @@ def check
log 'Emitting an event for mail: %s' % message_id

create_event :payload => {
'message_id' => message_id,
'folder' => mail.folder,
'subject' => mail.scrubbed(:subject),
'from' => mail.from_addrs.first,
Expand Down
2 changes: 2 additions & 0 deletions spec/models/agents/imap_folder_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def body_parts(mime_types = %[text/plain text/enriched text/html])
let(:expected_payloads) {
[
{
'message_id' => '[email protected]',
'folder' => 'INBOX',
'from' => '[email protected]',
'to' => ['[email protected]', '[email protected]'],
Expand All @@ -73,6 +74,7 @@ def body_parts(mime_types = %[text/plain text/enriched text/html])
'mime_type' => 'text/plain',
},
{
'message_id' => '[email protected]',
'folder' => 'INBOX',
'from' => '[email protected]',
'to' => ['[email protected]', '[email protected]'],
Expand Down

0 comments on commit 734b84d

Please sign in to comment.