ish_models 0.0.33.210 → 0.0.33.211
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 +4 -4
- data/lib/office/email_message.rb +21 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 846b485fb78f382c7d084c59e34ed913434821c725a22fd83ebc1cf13e65e7c0
|
4
|
+
data.tar.gz: 5f2a09a0a4671ffe36d0986ecc061de33c1a45188c8c9394fc73a04d3ae00b04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86344c408514561160296d4b4fc6a3647da3f85028fc3ac41cb9c03d7a7271ea2a4984c8875a9dda412d1306be1d6ffb5a960ce5f2e5a35e7b3259444c4704e6
|
7
|
+
data.tar.gz: aff1681e76aa26eb7d322ebe8988da180b6b20fa42c68c40b235b1ed45957b762f95a31969dfc3b00985c93eff267833415b75a92f06c849442aa7118bc44929
|
data/lib/office/email_message.rb
CHANGED
@@ -41,23 +41,34 @@ class Office::EmailMessage
|
|
41
41
|
|
42
42
|
## Copied to email_conversation
|
43
43
|
field :wp_term_ids, type: Array, default: []
|
44
|
+
|
44
45
|
## Tested manually ok, does not pass the spec. @TODO: hire to make pass spec? _vp_ 2023-03-07
|
45
46
|
def add_tag tag
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
case tag.class.name
|
48
|
+
when 'WpTag'
|
49
|
+
;
|
50
|
+
when 'String'
|
51
|
+
tag = WpTag.emailtag(tag)
|
49
52
|
else
|
50
|
-
throw "#
|
53
|
+
throw "#add_tag2 expects a WpTag or string (eg WpTag::INBOX) as the only parameter."
|
51
54
|
end
|
55
|
+
self[:wp_term_ids] = ( [ tag.id ] + self[:wp_term_ids] ).uniq
|
56
|
+
self.save!
|
52
57
|
end
|
53
58
|
def remove_tag tag
|
54
|
-
|
55
|
-
|
56
|
-
|
59
|
+
case tag.class.name
|
60
|
+
when 'WpTag'
|
61
|
+
;
|
62
|
+
when 'String'
|
63
|
+
tag = WpTag.emailtag(tag)
|
57
64
|
else
|
58
|
-
throw "#
|
65
|
+
throw "#remove_tag2 expects a WpTag or string (eg WpTag::INBOX) as the only parameter."
|
59
66
|
end
|
67
|
+
self[:wp_term_ids] = self[:wp_term_ids] - [ tag.id ]
|
68
|
+
out = self.save!
|
69
|
+
out
|
60
70
|
end
|
71
|
+
def rmtag tag; remove_tag tag; end
|
61
72
|
|
62
73
|
belongs_to :email_conversation
|
63
74
|
def conv
|
@@ -74,10 +85,12 @@ class Office::EmailMessage
|
|
74
85
|
from[0].split('@')[1]
|
75
86
|
end
|
76
87
|
|
88
|
+
## @TODO: move to email_conversation _vp_ 2023-03-24
|
77
89
|
def apply_filter filter
|
78
90
|
case filter.kind
|
79
91
|
when ::Office::EmailFilter::KIND_SKIP_INBOX
|
80
92
|
self.remove_tag( WpTag::INBOX )
|
93
|
+
self.conv.remove_tag( WpTag::INBOX )
|
81
94
|
when ::Office::EmailFilter::KIND_AUTORESPOND
|
82
95
|
Ish::EmailContext.create({
|
83
96
|
email_template: ::Tmpl.find_by_slug( filter.email_template_slug ),
|