wco_models 3.1.0.175 → 3.1.0.176
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/conversation.rb +42 -0
- 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: 17d234b960f5061db8dd3236d041580aec9252b78a97dd7a27e6c07e57a9cc53
|
|
4
|
+
data.tar.gz: 3aba8e65bd0e8797b6d34dfb64e5ec6f76a05265c4dc4b24474129758a3d5c80
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2117c701ac79832bee70a447f850f6828a9926ecb0d1dd4adcc4e9453de87b56f105ebc2cd1d0ae30bc73ab1dd99bafbc0e068e9d7da0fe39a5aa75ed2b585bd
|
|
7
|
+
data.tar.gz: d983e4bf6ebcb148233487d52cea7d58b0c532342099a4c20212f93190439ead3ad036a06570ec12e7947de98740145d3971cc38024b1f464f930726aa816ffc
|
|
@@ -33,6 +33,48 @@ class WcoEmail::Conversation
|
|
|
33
33
|
|
|
34
34
|
belongs_to :filter, class_name: 'WcoEmail::EmailFilter', inverse_of: :conversations, optional: true
|
|
35
35
|
|
|
36
|
+
def self.load_conversations_messages_tag_by_params_and_profile params, current_profile
|
|
37
|
+
@conversations = WcoEmail::Conversation.all
|
|
38
|
+
|
|
39
|
+
if params[:tagname]
|
|
40
|
+
@tag = Wco::Tag.find_by slug: params[:tagname]
|
|
41
|
+
@conversations = @conversations.where( :tag_ids.in => [ @tag.id ] )
|
|
42
|
+
end
|
|
43
|
+
if params[:tagname_not]
|
|
44
|
+
@tag_not = Wco::Tag.find_by slug: params[:tagname_not]
|
|
45
|
+
@conversations = @conversations.where( :tag_ids.nin => [ @tag_not.id ] )
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
if params[:subject].present?
|
|
49
|
+
@conversations = @conversations.where({ subject: /.*#{params[:subject]}.*/i })
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
if params[:from_email].present?
|
|
53
|
+
@conversations = @conversations.where({ from_emails: /.*#{params[:from_email]}.*/i })
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
if params[:lead_id].present?
|
|
57
|
+
@conversations = @conversations.where( lead_ids: params[:lead_id] )
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
@conversations = @conversations.where(
|
|
61
|
+
).includes( :leads, :messages, :tags
|
|
62
|
+
).order_by( latest_at: :desc
|
|
63
|
+
).page( params[:conv_page] ).per( current_profile.per_page )
|
|
64
|
+
|
|
65
|
+
conversation_ids = @conversations.map &:id
|
|
66
|
+
messages = WcoEmail::Message.where(
|
|
67
|
+
:conversation_id.in => conversation_ids,
|
|
68
|
+
read_at: nil,
|
|
69
|
+
)
|
|
70
|
+
@messages_hash = {}
|
|
71
|
+
messages.map do |msg|
|
|
72
|
+
@messages_hash[msg.id.to_s] = msg
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
return [ @conversations, @messages_hash, @tag ]
|
|
76
|
+
end
|
|
77
|
+
|
|
36
78
|
def cache_key
|
|
37
79
|
"#{self.class.name} #{id.to_s} #{updated_at}"
|
|
38
80
|
end
|
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.176
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Victor Pudeyev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-09-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ahoy_matey
|