ish_models 0.0.33.198 → 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: 54ec77875152771da2686c3a022fc1dc3f41415a80e62cd4a56e15168a964c5e
4
- data.tar.gz: 604894511517e208b79c2520aac8e05220cc4d19dd1733b369e78cc6920c6e4b
3
+ metadata.gz: c39f66420468113cfb31217b7d1b333b4e6ce7cddb147b416df79d94b9609957
4
+ data.tar.gz: a4172f8d87117e3a8163e24b44a180c5c8aae0bffadad80e65d12ec8175014a2
5
5
  SHA512:
6
- metadata.gz: d3a7503d1a6834ae0155e9894c67c194ee4bac5e5ccca3ffd3f86116365aea074e92f006852ad717627d725bef5005867fd45fb269b1699af5f94a70dc9975e7
7
- data.tar.gz: f1f2a2073c88c3531bb2668351d8f6776674e394f5c3ece94c223b3c8dca2eb95bda748ee79401f2272754507dc00e2f7ba5a374b20ddacdb12e65f7d3911c27
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.198
4
+ version: 0.0.33.200
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox