ishapi 0.1.8.307 → 0.1.8.309
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/app/jobs/ishapi/email_message_intake_job.rb +10 -11
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: bb2c27b0e76f833a8c226f0d3b8e2ddde4e79de43410a27d54b17fd7428bb2ea
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bdfca7a6011021de3e65cbef27bfd89bd0149d249e0f500c8b8f03234126769b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9f5c7c049720e975ab0dd41b8704058065b97e1e0e0cdac3d251f92776d771404f4ff3f6897008f09c0b597348e3af0d715028ef98bc0f829074b6a7284bd082
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 05b52de931750893643cd4a14ebcb6894111602e1f1eadbaa255a34cfbb8b003429837e6f91cf6340995cd815c6b83110c90bbd74b2a3bc92447ce9791fe6a9e
         
     | 
| 
         @@ -11,7 +11,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob 
     | 
|
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            =begin
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
              object_key = ' 
     | 
| 
      
 14 
     | 
    
         
            +
              object_key = 'b7t9ns5iqood9edbng1qqh89f2cishcviv1l2ro1'
         
     | 
| 
       15 
15 
     | 
    
         
             
              MsgStub.where({ object_key: object_key }).delete
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
              stub = MsgStub.create!({ object_key: object_key })
         
     | 
| 
         @@ -41,14 +41,10 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob 
     | 
|
| 
       41 
41 
     | 
    
         
             
                  message_id         = the_mail.header['message-id'].decoded
         
     | 
| 
       42 
42 
     | 
    
         
             
                  in_reply_to_id     = the_mail.header['in-reply-to']&.to_s
         
     | 
| 
       43 
43 
     | 
    
         
             
                  email_inbox_tag_id = WpTag.emailtag(WpTag::INBOX).id
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                  if !the_mail.to
         
     | 
| 
       46 
     | 
    
         
            -
                    the_mail.to = [ 'NO-RECIPIENT' ]
         
     | 
| 
       47 
     | 
    
         
            -
                  end
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
      
 44 
     | 
    
         
            +
                  the_mail.to        = [ 'NO-RECIPIENT' ] if !the_mail.to
         
     | 
| 
       49 
45 
     | 
    
         | 
| 
       50 
46 
     | 
    
         
             
                  subject   = ::Msg.strip_emoji the_mail.subject
         
     | 
| 
       51 
     | 
    
         
            -
                  subject ||= '(wco 
     | 
| 
      
 47 
     | 
    
         
            +
                  subject ||= '(wco-no-subject)'
         
     | 
| 
       52 
48 
     | 
    
         | 
| 
       53 
49 
     | 
    
         | 
| 
       54 
50 
     | 
    
         
             
                  ## Conversation
         
     | 
| 
         @@ -79,7 +75,6 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob 
     | 
|
| 
       79 
75 
     | 
    
         
             
                    in_reply_to_id: in_reply_to_id,
         
     | 
| 
       80 
76 
     | 
    
         | 
| 
       81 
77 
     | 
    
         
             
                    object_key:  stub.object_key,
         
     | 
| 
       82 
     | 
    
         
            -
                    # object_path: stub.object_path,
         
     | 
| 
       83 
78 
     | 
    
         | 
| 
       84 
79 
     | 
    
         
             
                    subject: subject,
         
     | 
| 
       85 
80 
     | 
    
         
             
                    date:    the_mail.date,
         
     | 
| 
         @@ -92,8 +87,6 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob 
     | 
|
| 
       92 
87 
     | 
    
         | 
| 
       93 
88 
     | 
    
         
             
                    cc:  the_mail.cc ? the_mail.cc[0] : nil,
         
     | 
| 
       94 
89 
     | 
    
         
             
                    ccs:  the_mail.cc,
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                    # bccs: the_mail.bcc,
         
     | 
| 
       97 
90 
     | 
    
         
             
                  })
         
     | 
| 
       98 
91 
     | 
    
         
             
                  if !@message.persisted?
         
     | 
| 
       99 
92 
     | 
    
         
             
                    throw "Could not create email_message: #{@message.errors.full_messages.join(', ')} ."
         
     | 
| 
         @@ -103,6 +96,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob 
     | 
|
| 
       103 
96 
     | 
    
         
             
                  the_mail.parts.each do |part|
         
     | 
| 
       104 
97 
     | 
    
         
             
                    @message.churn_subpart( part )
         
     | 
| 
       105 
98 
     | 
    
         
             
                  end
         
     | 
| 
      
 99 
     | 
    
         
            +
                  @message.save
         
     | 
| 
       106 
100 
     | 
    
         | 
| 
       107 
101 
     | 
    
         
             
                  if the_mail.parts.length == 0
         
     | 
| 
       108 
102 
     | 
    
         
             
                    body = the_mail.body.decoded.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
         
     | 
| 
         @@ -115,6 +109,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob 
     | 
|
| 
       115 
109 
     | 
    
         
             
                    else
         
     | 
| 
       116 
110 
     | 
    
         
             
                      @message.logs.push "mail body of unknown type: #{the_mail.content_type}"
         
     | 
| 
       117 
111 
     | 
    
         
             
                    end
         
     | 
| 
      
 112 
     | 
    
         
            +
                    @message.save
         
     | 
| 
       118 
113 
     | 
    
         
             
                  end
         
     | 
| 
       119 
114 
     | 
    
         | 
| 
       120 
115 
     | 
    
         
             
                  ## Attachments
         
     | 
| 
         @@ -159,6 +154,10 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob 
     | 
|
| 
       159 
154 
     | 
    
         
             
                    end
         
     | 
| 
       160 
155 
     | 
    
         
             
                  end
         
     | 
| 
       161 
156 
     | 
    
         | 
| 
      
 157 
     | 
    
         
            +
                  if !@message.save
         
     | 
| 
      
 158 
     | 
    
         
            +
                    puts! @message.errors.full_messages.join(", "), "Could not save @message"
         
     | 
| 
      
 159 
     | 
    
         
            +
                  end
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
       162 
161 
     | 
    
         
             
                  ## Leadset, Lead
         
     | 
| 
       163 
162 
     | 
    
         
             
                  domain  = @message.from.split('@')[1] rescue 'unknown.domain'
         
     | 
| 
       164 
163 
     | 
    
         
             
                  leadset = Leadset.find_or_create_by( company_url: domain )
         
     | 
| 
         @@ -194,7 +193,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob 
     | 
|
| 
       194 
193 
     | 
    
         | 
| 
       195 
194 
     | 
    
         
             
                      # || MiaTagger.analyze( @message.part_html, :is_spammy_recruite ).score > .5
         
     | 
| 
       196 
195 
     | 
    
         | 
| 
       197 
     | 
    
         
            -
                      puts! "applying filter #{filter} to conv #{conv}" if DEBUG
         
     | 
| 
      
 196 
     | 
    
         
            +
                      # puts! "applying filter #{filter} to conv #{conv}" if DEBUG
         
     | 
| 
       198 
197 
     | 
    
         | 
| 
       199 
198 
     | 
    
         
             
                      @message.apply_filter( filter )
         
     | 
| 
       200 
199 
     | 
    
         
             
                    end
         
     |