ishapi 0.1.8.290 → 0.1.8.292

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afc65013f9b8c9420320ffaddd059a328430126c3b0be0326041449e0d330b96
4
- data.tar.gz: 0b2a0202de0251bfa4ad4c7ae80b84f9062688f9a685f48c8577c209637fdb5c
3
+ metadata.gz: f0eccc109ec40b082e8f36531cda0b97d004b21dd4ecaa6e5631614fdc8d9051
4
+ data.tar.gz: de11d35fa75d9752c32dc8d6e0ee83b31a3cbfc5df3d05e11305931bb34ca555
5
5
  SHA512:
6
- metadata.gz: 6d8137e429313ddd6104bb6bd686a479079d18269b579c179a3f5d240877650c2c5451d5beb71c117b90eaeab865856bfd5db776f767868324ad580a614263ed
7
- data.tar.gz: ad65080c8891232fd4000830dd4f66585c260e52db59103f4c7a07c63bb29045f8f38a403702720cbaa67ed86ee4a078612b0ada309805d545e2deabae310e77
6
+ metadata.gz: c1b9e369a9dd15f3aa8dbba842bddf94ab5ea3c3d99df44f452b90da7b906a9f65e69475814aaf7cf04d78c79c7d1862047b3138e1b7d0d27b6ed411b8e952b0
7
+ data.tar.gz: 8d461fc7c5ba44dc92c1e27bb1a5ede8188b9387578341a5848cd0d29155aa30b6e004b4cdac4cd580a756561c4b4c45d80a13562a3665dd8855975b244c600a
@@ -44,6 +44,28 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
44
44
  end
45
45
  end
46
46
 
47
+ ## From: https://stackoverflow.com/questions/24672834/how-do-i-remove-emoji-from-string/24673322
48
+ def strip_emoji(text)
49
+ text = text.force_encoding('utf-8').encode
50
+ clean = ""
51
+
52
+ # symbols & pics
53
+ regex = /[\u{1f300}-\u{1f5ff}]/
54
+ clean = text.gsub regex, ""
55
+
56
+ # enclosed chars
57
+ regex = /[\u{2500}-\u{2BEF}]/ # I changed this to exclude chinese char
58
+ clean = clean.gsub regex, ""
59
+
60
+ # emoticons
61
+ regex = /[\u{1f600}-\u{1f64f}]/
62
+ clean = clean.gsub regex, ""
63
+
64
+ #dingbats
65
+ regex = /[\u{2702}-\u{27b0}]/
66
+ clean = clean.gsub regex, ""
67
+ end
68
+
47
69
  def perform id
48
70
  stub = ::Office::EmailMessageStub.find id
49
71
  if !Rails.env.test?
@@ -69,6 +91,10 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
69
91
  the_mail.to = [ 'NO-RECIPIENT' ]
70
92
  end
71
93
 
94
+
95
+ subject = strip_emoji the_mail.subject
96
+ subject ||= '(wco no subject)'
97
+
72
98
  @message = ::Office::EmailMessage.where( message_id: message_id ).first
73
99
  @message ||= ::Office::EmailMessage.new
74
100
  @message.assign_attributes({
@@ -80,10 +106,10 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
80
106
  object_key: stub.object_key,
81
107
  # object_path: stub.object_path,
82
108
 
83
- subject: the_mail.subject || 'NO SUBJECT HEREZZ',
109
+ subject: subject,
84
110
  date: the_mail.date,
85
111
 
86
- from: the_mail.from ? the_mail.from[0] : "NOBODY@UNKNOWN.DOMAIN",
112
+ from: the_mail.from ? the_mail.from[0] : "nobody@unknown.domain",
87
113
  froms: the_mail.from,
88
114
 
89
115
  to: the_mail.to ? the_mail.to[0] : nil,
@@ -130,7 +156,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
130
156
  end
131
157
 
132
158
  ## Leadset, Lead
133
- domain = @message.from.split('@')[1] rescue 'UNKNOWN.DOMAIN'
159
+ domain = @message.from.split('@')[1] rescue 'unknown.domain'
134
160
  leadset = Leadset.find_or_create_by( company_url: domain )
135
161
  lead = Lead.find_or_create_by( email: @message.from, m3_leadset_id: leadset.id )
136
162
 
@@ -139,7 +165,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
139
165
  in_reply_to_msg = ::Office::EmailMessage.where({ message_id: in_reply_to_id }).first
140
166
  if !in_reply_to_msg
141
167
  conv = ::Office::EmailConversation.find_or_create_by({
142
- subject: the_mail.subject,
168
+ subject: @message.subject,
143
169
  })
144
170
  in_reply_to_msg = ::Office::EmailMessage.find_or_create_by({
145
171
  message_id: in_reply_to_id,
@@ -149,7 +175,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
149
175
  conv = in_reply_to_msg.email_conversation
150
176
  else
151
177
  conv = ::Office::EmailConversation.find_or_create_by({
152
- subject: the_mail.subject,
178
+ subject: @message.subject,
153
179
  })
154
180
  end
155
181
  @message.update_attributes({ email_conversation_id: conv.id })
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.290
4
+ version: 0.1.8.292
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-24 00:00:00.000000000 Z
11
+ date: 2023-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails