wco_models 3.1.0.276 → 3.1.0.278
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/app/models/wco_email/email_filter.rb +60 -62
- data/app/models/wco_email/message.rb +1 -1
- data/app/models/wco_email/message_stub.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: acb9e2da69be5556f764520c42c4485129d89e9e9ef24a3db673a6bca94853f2
|
|
4
|
+
data.tar.gz: 40ae6eb798c0c1c4d20a6ffb849f6b8f831702e062539eea0b9b1eeaa9d28c2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 90326310bae152ab2f7966cd0bf957c7ce0b3cef882d2a3179510585cb26f859aab6b45e7c6222066be611cfdc2b94722922369f671d552667976dfb07294aaf
|
|
7
|
+
data.tar.gz: 1911fcd3025f363251ab78864b31ebe1ab262d0231629665c3ef1e3dcb8d7bd8cd498d8f51de3a2968c65d08659cbb8eeaefe874fe014212470d735d3b773afa
|
|
@@ -5,22 +5,10 @@ class WcoEmail::EmailFilter
|
|
|
5
5
|
include Mongoid::Paranoia
|
|
6
6
|
store_in collection: 'office_email_filters' ## 'wco_email_email_filters'
|
|
7
7
|
|
|
8
|
-
field :
|
|
8
|
+
field :slug, type: :string
|
|
9
9
|
|
|
10
10
|
PAGE_PARAM_NAME = :filters_page
|
|
11
11
|
|
|
12
|
-
## @deprecated, use email_filter_conditions
|
|
13
|
-
field :from_regex
|
|
14
|
-
field :from_exact
|
|
15
|
-
field :subject_regex
|
|
16
|
-
field :subject_exact
|
|
17
|
-
field :body_regex
|
|
18
|
-
field :body_exact
|
|
19
|
-
field :tag_id_exact
|
|
20
|
-
|
|
21
|
-
field :skip_from_regex
|
|
22
|
-
field :skip_to_exact
|
|
23
|
-
|
|
24
12
|
STATUS_ACTIVE = 'active'
|
|
25
13
|
STATUS_INACTIVE = 'inactive'
|
|
26
14
|
field :status, type: :string, default: STATUS_ACTIVE
|
|
@@ -35,58 +23,27 @@ class WcoEmail::EmailFilter
|
|
|
35
23
|
end
|
|
36
24
|
end
|
|
37
25
|
|
|
38
|
-
## 'and' - all conditions must match, for filter to match
|
|
39
26
|
has_many :conditions, class_name: '::WcoEmail::EmailFilterCondition', inverse_of: :email_filter
|
|
40
27
|
accepts_nested_attributes_for :conditions, allow_destroy: true, reject_if: :all_blank
|
|
41
|
-
|
|
42
|
-
## 'and' - all conditions must match, for filter to match
|
|
43
|
-
has_many :skip_conditions, class_name: '::WcoEmail::EmailFilterCondition', inverse_of: :email_skip_filter
|
|
44
|
-
accepts_nested_attributes_for :skip_conditions, allow_destroy: true, reject_if: :all_blank
|
|
45
|
-
|
|
46
|
-
# validate :validate_conditions
|
|
28
|
+
validate :validate_conditions
|
|
47
29
|
def validate_conditions
|
|
48
|
-
if conditions.length
|
|
49
|
-
errors.add(:
|
|
30
|
+
if conditions.length == 0
|
|
31
|
+
errors.add(:condition, 'must be present')
|
|
50
32
|
end
|
|
51
33
|
end
|
|
52
34
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
## @deprecated 2026-04-02
|
|
56
|
-
KIND_AUTORESPOND_TMPL = 'autorespond-template'
|
|
57
|
-
KIND_AUTORESPOND_EACT = 'autorespond-email-action'
|
|
58
|
-
KIND_REMOVE_TAG = 'remove-tag'
|
|
59
|
-
KIND_ADD_TAG = 'add-tag'
|
|
60
|
-
KIND_DESTROY_SCHS = 'destroy-schs'
|
|
61
|
-
KIND_OAT = 'office-action'
|
|
62
|
-
|
|
63
|
-
## @deprecated
|
|
64
|
-
KIND_AUTORESPOND = 'autorespond' ## @deprecated, DO NOT USE!
|
|
65
|
-
KIND_DELETE = 'delete' ## @deprecated, use add-tag
|
|
66
|
-
KIND_SKIP_INBOX = 'skip-inbox' ## @deprecated, use remove-tag
|
|
67
|
-
|
|
68
|
-
KINDS = [ nil, KIND_OAT, KIND_AUTORESPOND_TMPL, KIND_AUTORESPOND_EACT, KIND_ADD_TAG, KIND_REMOVE_TAG, KIND_DESTROY_SCHS ]
|
|
69
|
-
field :kind ## @deprecated, use filter.action.aject.kind 2026-04-02
|
|
70
|
-
|
|
35
|
+
has_many :skip_conditions, class_name: '::WcoEmail::EmailFilterCondition', inverse_of: :email_skip_filter
|
|
36
|
+
accepts_nested_attributes_for :skip_conditions, allow_destroy: true, reject_if: :all_blank
|
|
71
37
|
|
|
72
|
-
|
|
73
|
-
|
|
38
|
+
has_and_belongs_to_many :leadsets, class_name: '::Wco::Leadset'
|
|
39
|
+
has_and_belongs_to_many :conversations, class_name: '::WcoEmail::Conversation'
|
|
74
40
|
|
|
75
|
-
## no habtm please
|
|
76
|
-
# has_and_belongs_to_many :action_tmpls, class_name: '::Wco::OfficeActionTemplate'
|
|
77
|
-
belongs_to :office_action_template, class_name: '::Wco::OfficeActionTemplate', optional: true
|
|
78
41
|
belongs_to :tag, class_name: '::Wco::Tag', optional: true, inverse_of: :email_filters
|
|
79
42
|
|
|
80
|
-
has_and_belongs_to_many :conversations, class_name: '::WcoEmail::Conversation'
|
|
81
|
-
|
|
82
43
|
def to_s
|
|
83
44
|
"EmailFilter: #{from_regex} #{from_exact} #{conditions.map { |c| c.to_s }.join }"
|
|
84
45
|
end
|
|
85
46
|
def to_s_full
|
|
86
|
-
# inn = ""
|
|
87
|
-
# inn = "#{inn}#{conditions.map { |c| c.to_s_full }.join }" if conditions.present?
|
|
88
|
-
# inn = "#{inn}#{skip_conditions.map { |c| c.to_s_full }.join }" if skip_conditions.present?
|
|
89
|
-
|
|
90
47
|
attrs = ''
|
|
91
48
|
if from_regex || from_exact
|
|
92
49
|
attrs = "#{attrs} from=#{from_regex}#{from_exact}"
|
|
@@ -105,19 +62,60 @@ AOL
|
|
|
105
62
|
out
|
|
106
63
|
end
|
|
107
64
|
|
|
108
|
-
def to_xml
|
|
109
|
-
attrs = ''
|
|
110
|
-
children = ''
|
|
111
|
-
if from_regex || from_exact
|
|
112
|
-
attrs = "#{attrs} from=#{from_regex}#{from_exact}"
|
|
113
|
-
end
|
|
114
|
-
if conditions.present?
|
|
115
|
-
children = "#{children}#{conditions.map { |c| c.to_s }.join('') }"
|
|
116
|
-
end
|
|
117
|
-
return "<EF #{attrs}>#{children}</EF>\n"
|
|
118
|
-
end
|
|
119
65
|
|
|
120
66
|
|
|
121
67
|
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
##
|
|
71
|
+
## deprecated
|
|
72
|
+
##
|
|
73
|
+
|
|
74
|
+
## @deprecated, use email_filter_conditions
|
|
75
|
+
field :from_regex
|
|
76
|
+
field :from_exact
|
|
77
|
+
field :subject_regex
|
|
78
|
+
field :subject_exact
|
|
79
|
+
field :body_regex
|
|
80
|
+
field :body_exact
|
|
81
|
+
field :tag_id_exact
|
|
82
|
+
|
|
83
|
+
field :skip_from_regex
|
|
84
|
+
field :skip_to_exact
|
|
85
|
+
|
|
86
|
+
## @deprecated 2026-04-02, use email_filter_action::<KIND>
|
|
87
|
+
KIND_AUTORESPOND_TMPL = 'autorespond-template'
|
|
88
|
+
KIND_AUTORESPOND_EACT = 'autorespond-email-action'
|
|
89
|
+
KIND_REMOVE_TAG = 'remove-tag'
|
|
90
|
+
KIND_ADD_TAG = 'add-tag'
|
|
91
|
+
KIND_DESTROY_SCHS = 'destroy-schs'
|
|
92
|
+
KIND_OAT = 'office-action'
|
|
93
|
+
|
|
94
|
+
## @deprecated
|
|
95
|
+
KIND_AUTORESPOND = 'autorespond' ## @deprecated, DO NOT USE!
|
|
96
|
+
KIND_DELETE = 'delete' ## @deprecated, use add-tag
|
|
97
|
+
KIND_SKIP_INBOX = 'skip-inbox' ## @deprecated, use remove-tag
|
|
98
|
+
|
|
99
|
+
KINDS = [ nil, KIND_OAT, KIND_AUTORESPOND_TMPL, KIND_AUTORESPOND_EACT, KIND_ADD_TAG, KIND_REMOVE_TAG, KIND_DESTROY_SCHS ]
|
|
100
|
+
field :kind ## @deprecated, use filter.action.aject.kind 2026-04-02
|
|
101
|
+
|
|
102
|
+
## @deprecated, use email_filter.email_action.aject
|
|
103
|
+
belongs_to :email_template, class_name: '::WcoEmail::EmailTemplate', optional: true
|
|
104
|
+
belongs_to :email_action_template, class_name: '::WcoEmail::EmailActionTemplate', optional: true
|
|
105
|
+
belongs_to :office_action_template, class_name: '::Wco::OfficeActionTemplate', optional: true
|
|
106
|
+
|
|
107
|
+
## use to_s_full
|
|
108
|
+
# def to_xml
|
|
109
|
+
# attrs = ''
|
|
110
|
+
# children = ''
|
|
111
|
+
# if from_regex || from_exact
|
|
112
|
+
# attrs = "#{attrs} from=#{from_regex}#{from_exact}"
|
|
113
|
+
# end
|
|
114
|
+
# if conditions.present?
|
|
115
|
+
# children = "#{children}#{conditions.map { |c| c.to_s }.join('') }"
|
|
116
|
+
# end
|
|
117
|
+
# return "<EF #{attrs}>#{children}</EF>\n"
|
|
118
|
+
# end
|
|
119
|
+
|
|
122
120
|
end
|
|
123
121
|
::EF = WcoEmail::EmailFilter
|
|
@@ -128,7 +128,7 @@ class WcoEmail::MessageStub
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
## Actions & Filters
|
|
131
|
-
email_filters = WcoEmail::EmailFilter.all
|
|
131
|
+
email_filters = WcoEmail::EmailFilter.all.active
|
|
132
132
|
email_filters.each do |filter|
|
|
133
133
|
reason = nil
|
|
134
134
|
if filter.from_regex.present? && @message.from.downcase.match( filter.from_regex )
|
|
@@ -315,7 +315,7 @@ class WcoEmail::MessageStub
|
|
|
315
315
|
|
|
316
316
|
|
|
317
317
|
## Actions & Filters
|
|
318
|
-
email_filters = WcoEmail::EmailFilter.all
|
|
318
|
+
email_filters = WcoEmail::EmailFilter.all.active
|
|
319
319
|
email_filters.each do |filter|
|
|
320
320
|
reason = nil
|
|
321
321
|
if filter.from_regex.present? && @message.from.downcase.match( filter.from_regex )
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wco_models
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.1.0.
|
|
4
|
+
version: 3.1.0.278
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Victor Pudeyev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aws-sdk-s3
|