ish_models 0.0.33.210 → 0.0.33.212
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ish/email_context.rb +3 -0
- data/lib/ish_models.rb +1 -0
- data/lib/office/email_action.rb +13 -8
- data/lib/office/email_action_tie.rb +37 -0
- data/lib/office/email_message.rb +21 -8
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c44b73e125b69cd7cfe86af7801f5b0192c19b4d4fcf8a080879342ff8da0c7
|
4
|
+
data.tar.gz: 907323dd21684b8b4b73a23a5d4891bf06ec2126eecdde8e7e14073a7aa0dec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb26137627d7577a249ff8c3e07cb6643c1d89509bfa92c32ed423ff41c269fc5a377eff14268f97b4937aa87472bb030a2636fc777c7d28be0f5ccbf67bde05
|
7
|
+
data.tar.gz: bf9475b51920b917d3ebcaff3db5101df7c8ff10ea8f6d48bf3364a1969151b03b562626353d8b6562ce07598d39084c40d0492bf231a9a240dc869d38b4fcdf
|
data/lib/ish/email_context.rb
CHANGED
data/lib/ish_models.rb
CHANGED
data/lib/office/email_action.rb
CHANGED
@@ -7,23 +7,28 @@ class Office::EmailAction
|
|
7
7
|
include Mongoid::Document
|
8
8
|
include Mongoid::Timestamps
|
9
9
|
|
10
|
+
# field :next_at_exe, type: :string
|
11
|
+
# field :next_in_days, type: :string
|
12
|
+
# field :next_at_time, type: :string
|
13
|
+
|
10
14
|
field :slug, type: :string
|
11
15
|
validates :slug, uniqueness: true, allow_nil: true
|
12
16
|
|
13
|
-
field :descr, type: :string
|
17
|
+
field :descr, type: :string ## optional, can remove
|
14
18
|
|
15
19
|
belongs_to :email_template, class_name: '::Ish::EmailTemplate'
|
16
20
|
def tmpl; email_template; end
|
17
21
|
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
belongs_to :prev_email_action, class_name: '::Office::EmailAction', optional: true, inverse_of: :next_email_actions
|
23
|
-
has_many :next_email_actions, class_name: '::Office::EmailAction', inverse_of: :prev_email_action
|
22
|
+
# belongs_to :prev_email_action, class_name: '::Office::EmailAction', optional: true, inverse_of: :next_email_actions
|
23
|
+
# has_many :next_email_actions, class_name: '::Office::EmailAction', inverse_of: :prev_email_action
|
24
|
+
# accepts_nested_attributes_for :next_email_actions
|
24
25
|
|
25
26
|
has_many :scheduled_email_actions, class_name: '::Office::ScheduledEmailAction'
|
26
27
|
def schs; scheduled_email_actions; end
|
27
28
|
|
28
|
-
|
29
|
+
has_many :ties, class_name: '::Office::EmailActionTie', inverse_of: :email_action
|
30
|
+
has_many :prev_ties, class_name: '::Office::EmailActionTie', inverse_of: :next_email_action
|
31
|
+
accepts_nested_attributes_for :ties
|
29
32
|
|
33
|
+
end
|
34
|
+
Act = Office::EmailAction
|
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
##
|
3
|
+
## act = Act.new ; tie = Actie.new; act.ties.push( tie )
|
4
|
+
##
|
5
|
+
class Office::EmailActionTie
|
6
|
+
include Mongoid::Document
|
7
|
+
include Mongoid::Timestamps
|
8
|
+
|
9
|
+
attr_accessor :to_delete
|
10
|
+
|
11
|
+
belongs_to :email_action, class_name: '::Office::EmailAction', inverse_of: :ties
|
12
|
+
belongs_to :next_email_action, class_name: '::Office::EmailAction', inverse_of: :prev_ties
|
13
|
+
|
14
|
+
|
15
|
+
field :next_at_exe, type: :string
|
16
|
+
validates :next_at_exe, presence: true
|
17
|
+
|
18
|
+
# field :next_in_days, type: :string
|
19
|
+
# field :next_at_time, type: :string
|
20
|
+
|
21
|
+
# field :slug, type: :string
|
22
|
+
# validates :slug, uniqueness: true, allow_nil: true
|
23
|
+
|
24
|
+
# field :descr, type: :string ## optional, can remove
|
25
|
+
|
26
|
+
# belongs_to :email_template, class_name: '::Ish::EmailTemplate'
|
27
|
+
# def tmpl; email_template; end
|
28
|
+
|
29
|
+
# belongs_to :prev_email_action, class_name: '::Office::EmailAction', optional: true, inverse_of: :next_email_actions
|
30
|
+
# has_many :next_email_actions, class_name: '::Office::EmailAction', inverse_of: :prev_email_action
|
31
|
+
# accepts_nested_attributes_for :next_email_actions
|
32
|
+
|
33
|
+
# has_many :scheduled_email_actions, class_name: '::Office::ScheduledEmailAction'
|
34
|
+
# def schs; scheduled_email_actions; end
|
35
|
+
|
36
|
+
end
|
37
|
+
Actie = Office::EmailActionTie
|
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 ),
|
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.
|
4
|
+
version: 0.0.33.212
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- lib/mongoid/voter.rb
|
145
145
|
- lib/newsitem.rb
|
146
146
|
- lib/office/email_action.rb
|
147
|
+
- lib/office/email_action_tie.rb
|
147
148
|
- lib/office/email_conversation.rb
|
148
149
|
- lib/office/email_filter.rb
|
149
150
|
- lib/office/email_message.rb
|