ishapi 0.1.8.270 → 0.1.8.272

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e40debbf51442f7426b3fa9b4a700af10766bd23635a0116c78c85bbfcd6027
4
- data.tar.gz: 23bce39fcda81bcb65fbec51cff028488156ad4ef6f9d33d30cf368604065c82
3
+ metadata.gz: 4a9b5821802e8c966adddf0709fd2ffc3e3bb45dd1530630498480b3a79fc542
4
+ data.tar.gz: 73c04826bb8d276cd691989bb12c2ff4254b53de47cc05eb08b340517fe75783
5
5
  SHA512:
6
- metadata.gz: 8cc8ff05edd80990587fc0e7b001ba35d5e5af9b89fdc788b260ea67f9729e0e1556339f7ccb85c6c63650abd5a0c7e662b2ca62273cd34f16ca3b26fc07249b
7
- data.tar.gz: 31a5b803706e621d22ac2afff46c6aefa14b4a0a5493a29f4c2765ff52c5c6449b3122665fedcbc83ba3560fa815f808b757e7c6d121189bb87c3927c4a4c9d3
6
+ metadata.gz: 84f98f56355046723fa4b7eb2d6d7737b9885647ec5f6f29bdf62ed9ff48c14418451c06096243ec57e0f9d8887a713b5276c07a1ba87a5ae1bae2a20042924f
7
+ data.tar.gz: c1bb78d47ccd0594eb8720fad830ea1f9c29e0d9f298ebc7753d3d47712bb09630832113fd51e76692322ef548bdc5e1a3e4c4da62093a3cdbcc6a490d31c2c9
@@ -127,6 +127,11 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
127
127
  end
128
128
  end
129
129
 
130
+ ## Leadset, Lead
131
+ domain = @message.from.split('@')[1]
132
+ leadset = Leadset.find_or_create_by( company_url: domain )
133
+ lead = Lead.find_or_create_by( email: @message.from, m3_leadset_id: leadset.id )
134
+
130
135
  ## Conversation
131
136
  if in_reply_to_id
132
137
  in_reply_to_msg = ::Office::EmailMessage.where({ message_id: in_reply_to_id }).first
@@ -145,44 +150,33 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
145
150
  subject: the_mail.subject,
146
151
  })
147
152
  end
148
- @message.email_conversation_id = conv.id
153
+ @message.update_attributes({ email_conversation_id: conv.id })
149
154
  conv.update_attributes({
150
- state: Conv::STATE_UNREAD,
155
+ state: Conv::STATE_UNREAD,
151
156
  latest_at: the_mail.date || Time.now.to_datetime,
157
+ lead_ids: conv.lead_ids.push( lead.id ).uniq,
152
158
  wp_term_ids: ( [ email_inbox_tag_id ] + conv.wp_term_ids + stub.wp_term_ids ).uniq,
153
159
  })
154
160
 
155
- ## Leadset
156
- domain = @message.from.split('@')[1]
157
- leadset = Leadset.find_or_create_by( company_url: domain )
158
-
159
- ## Lead
160
- lead = Lead.find_or_create_by( email: @message.from, m3_leadset_id: leadset.id )
161
- conv.lead_ids = conv.lead_ids.push( lead.id ).uniq
162
-
163
161
  ## Actions & Filters
164
162
  email_filters = Office::EmailFilter.active
165
163
  email_filters.each do |filter|
166
- if ( filter.from_regex.blank? || @message.from.match( filter.from_regex ) ) &&
167
- ( filter.body_regex.blank? || @message.part_html.match( filter.body_regex ) ) &&
168
- ( filter.subject_regex.blank? || @message.subject.match( filter.subject_regex ) )
164
+ if ( filter.from_regex.blank? || @message.from.match( filter.from_regex ) ) &&
165
+ ( filter.from_exact.blank? || @message.from.downcase.include?( filter.from_exact ) ) &&
166
+ ( filter.body_exact.blank? || @message.part_html.include?( filter.body_exact ) ) &&
167
+ ( filter.subject_regex.blank? || @message.subject.match( filter.subject_regex ) ) &&
168
+ ( filter.subject_exact.blank? || @message.subject.include?( filter.subject_exact ) )
169
+
169
170
  # || MiaTagger.analyze( @message.part_html, :is_spammy_recruite ).score > .5
170
171
 
171
172
  @message.apply_filter( filter )
172
173
  end
173
174
  end
174
175
 
175
- ## Save to exit
176
- flag = @message.save
177
- # if flag
178
- # puts! @message.message_id, 'Saved this message'
179
- # else
180
- # puts! @message.errors.full_messages.join(', '), 'Cannot save email_message'
181
- # end
182
- conv.save
183
176
  stub.update_attributes({ state: ::Office::EmailMessageStub::STATE_PROCESSED })
184
177
 
185
178
  ## Notification
179
+ conv.reload
186
180
  if conv.wp_term_ids.include?( email_inbox_tag_id )
187
181
  out = ::Ishapi::ApplicationMailer.forwarder_notify( @message.id.to_s )
188
182
  Rails.env.production? ? out.deliver_later : out.deliver_now
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ishapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.270
4
+ version: 0.1.8.272
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-18 00:00:00.000000000 Z
11
+ date: 2023-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails