ish_models 0.0.33.200 → 0.0.33.202

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: c39f66420468113cfb31217b7d1b333b4e6ce7cddb147b416df79d94b9609957
4
- data.tar.gz: a4172f8d87117e3a8163e24b44a180c5c8aae0bffadad80e65d12ec8175014a2
3
+ metadata.gz: f4d55a1db780f3a656dc89b8f42080058fbf3fe63cf68a078e15ded503b1fc3f
4
+ data.tar.gz: c3b8b68584d144d8eb0afd391fd1c85a4f43f9f8b891377512bc82fca349abbb
5
5
  SHA512:
6
- metadata.gz: 5e65a7d641d83c37c28689f4a16652af4c4b3cfda69361d5392638ed986a6faa96e8b44599ec0864fafebcd65cf02ab44be2f215f957294b02c46e5608b3529c
7
- data.tar.gz: 75a064e75948b1befc3f83eefa7defb205a3bac581227a47022c22b04aace3665da751152d87699e52211ca1e2e7f9470e47f7d731296f8d1ed1067bda1fa4cd
6
+ metadata.gz: 27fa2bf8d18914900c1671f39c8cbaf04c1dd6d1f047d0fe435a7ef64ea70bd56fb5ac0e85e007d74a4859b4d9362d390d97c83ea56003f17b7534be9ef8e564
7
+ data.tar.gz: 8e4a9af7e7ace39f488c46c35175b60e6c85f7ae509a5d8ff281e1aae67d931907d5d24a8533a0f90d25079e974d3491ddb5e760b5e53cf17a548a09f4d899b4
@@ -33,12 +33,17 @@ class Office::EmailConversation
33
33
 
34
34
  ## Tested manually ok, does not pass the spec. @TODO: hire to make pass spec? _vp_ 2023-03-07
35
35
  def add_tag tag
36
- if WpTag == tag.class
37
- self[:wp_term_ids] = self[:wp_term_ids].push(tag.id).uniq
38
- self.save!
36
+ case tag.class.name
37
+ when 'WpTag'
38
+ ;
39
+ when 'String'
40
+ tag = WpTag.emailtag(tag)
39
41
  else
40
- throw "#add_tag expects a WpTag as the only parameter."
42
+ throw "#add_tag expects a WpTag or string (eg WpTag::EMAILTAG_INBOX) as the only parameter."
41
43
  end
44
+ puts! tag, 'tag'
45
+ self[:wp_term_ids] = ( [ tag.id ] + self[:wp_term_ids] ).uniq
46
+ self.save!
42
47
  end
43
48
 
44
49
  def remove_tag tag
@@ -54,6 +59,23 @@ class Office::EmailConversation
54
59
  ::Office::EmailConversation.where( :wp_term_ids => WpTag.email_inbox_tag.id ).order_by( latest_at: :desc )
55
60
  end
56
61
 
62
+ def self.in_no_trash
63
+ trash_id = WpTag.emailtag('trash').id
64
+ return ::Office::EmailConversation.where( :wp_term_ids.ne => trash_id ).order_by( latest_at: :desc )
65
+ end
66
+
67
+ def self.in_emailtag which
68
+ case which.class.name
69
+ when 'String'
70
+ tag_id = WpTag.emailtag(which).id
71
+ when 'WpTag'
72
+ tag_id = which.id
73
+ else
74
+ throw "unsupported in #in_emailtag: #{which}"
75
+ end
76
+ return ::Office::EmailConversation.where( :wp_term_ids => tag_id ).order_by( latest_at: :desc )
77
+ end
78
+
57
79
  end
58
80
  # EmailConversation = Office::EmailConversation
59
81
  Conv = Office::EmailConversation
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.200
4
+ version: 0.0.33.202
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox