ish_models 0.0.33.199 → 0.0.33.200

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: be6a67454f480e9326367814538e156463b46ebfe974dea533ba34a39195b0c7
4
- data.tar.gz: 884761d610983c25d8346a3d1f51ce8e8b4026a70ffeec8a907acf5142ea6283
3
+ metadata.gz: c39f66420468113cfb31217b7d1b333b4e6ce7cddb147b416df79d94b9609957
4
+ data.tar.gz: a4172f8d87117e3a8163e24b44a180c5c8aae0bffadad80e65d12ec8175014a2
5
5
  SHA512:
6
- metadata.gz: eaa67007ba2789c286437cd07e04bc3db129e57025599cdebe21fd468f29a1e7c0756ab894f62c8b1ea7aaf193ddcf27a0a424c04d75f070348c13702323783f
7
- data.tar.gz: eec156543395ad6f723b4ef73f06264b183f17d17daf523bd4d684148da9bf652739c12cd3140d0fababf2cc6df49643135e0e9887bfa498bdfafef0ace38bdc
6
+ metadata.gz: 5e65a7d641d83c37c28689f4a16652af4c4b3cfda69361d5392638ed986a6faa96e8b44599ec0864fafebcd65cf02ab44be2f215f957294b02c46e5608b3529c
7
+ data.tar.gz: 75a064e75948b1befc3f83eefa7defb205a3bac581227a47022c22b04aace3665da751152d87699e52211ca1e2e7f9470e47f7d731296f8d1ed1067bda1fa4cd
@@ -17,18 +17,20 @@ class Office::EmailConversation
17
17
  Lead.find( lead_ids )
18
18
  end
19
19
 
20
- field :term_ids, type: :array, default: []
21
- def tags
22
- WpTag.find( term_ids )
23
- end
20
+
24
21
 
25
22
  has_many :email_messages
26
23
  def email_messages
27
24
  Office::EmailMessage.where( email_conversation_id: self.id )
28
25
  end
29
26
 
27
+ def tags
28
+ WpTag.find( wp_term_ids )
29
+ end
30
+
30
31
  ## Copied from email_message
31
32
  field :wp_term_ids, type: Array, default: []
33
+
32
34
  ## Tested manually ok, does not pass the spec. @TODO: hire to make pass spec? _vp_ 2023-03-07
33
35
  def add_tag tag
34
36
  if WpTag == tag.class
@@ -38,6 +40,7 @@ class Office::EmailConversation
38
40
  throw "#add_tag expects a WpTag as the only parameter."
39
41
  end
40
42
  end
43
+
41
44
  def remove_tag tag
42
45
  if WpTag == tag.class
43
46
  self[:wp_term_ids].delete( tag.id )
@@ -47,6 +50,10 @@ class Office::EmailConversation
47
50
  end
48
51
  end
49
52
 
53
+ def self.in_inbox
54
+ ::Office::EmailConversation.where( :wp_term_ids => WpTag.email_inbox_tag.id ).order_by( latest_at: :desc )
55
+ end
56
+
50
57
  end
51
58
  # EmailConversation = Office::EmailConversation
52
59
  Conv = Office::EmailConversation
@@ -101,26 +101,3 @@ class Office::EmailMessage
101
101
 
102
102
  end
103
103
  ::Msg = Office::EmailMessage
104
-
105
-
106
-
107
- ## trash _vp_ 2023-03-07
108
- # def process
109
- # Aws.config[:credentials] = Aws::Credentials.new(
110
- # ::S3_CREDENTIALS[:access_key_id],
111
- # ::S3_CREDENTIALS[:secret_access_key]
112
- # )
113
- # s3 = Aws::S3::Client.new
114
- # obj = s3.get_object({
115
- # bucket: 'ish-ses',
116
- # key: self.object_key
117
- # })
118
- # obj2 = obj.body.read
119
- # mail = Mail.read_from_string( obj2 )
120
- # self.from = mail.from
121
- # self.to = mail.to
122
- # self.subject = mail.subject
123
- # self.date = mail.date
124
- # self.raw = obj2
125
- # self.save
126
- # end
@@ -17,7 +17,7 @@ class Office::EmailMessageStub
17
17
  field :object_path, type: :string ## A routable s3 url ## @TODO: remove this field. _vp_ 2023-03-07
18
18
  # validates_presence_of :object_path ## only need object_key == message_id
19
19
 
20
- field :term_ids, type: :array, default: []
20
+ field :wp_term_ids, type: :array, default: []
21
21
 
22
22
  end
23
23
  Stub = EMS = Office::EmailMessageStub
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33.199
4
+ version: 0.0.33.200
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox