wco_models 3.1.0.174 → 3.1.0.176

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: 3123e82f0b6b6c73467f25b805938849fec0eb0cdc83fabff9d0d4eb7636759e
4
- data.tar.gz: 3f00797cf55c973a2fbc67d44c62d5b1fe9d2a8794b2a12f8c20b9a3674e681f
3
+ metadata.gz: 17d234b960f5061db8dd3236d041580aec9252b78a97dd7a27e6c07e57a9cc53
4
+ data.tar.gz: 3aba8e65bd0e8797b6d34dfb64e5ec6f76a05265c4dc4b24474129758a3d5c80
5
5
  SHA512:
6
- metadata.gz: 9291087081326216d314e00878343ec5b27e5aa45d4de1029ceadd02681926db68ce20188ccd91e107b9b247b1f58e47bc4c63ff17fb350a3bdf66ecdeb8bc93
7
- data.tar.gz: e49aac91b44d0560f79f2bd9e402c2a833b8885eed54c9881d464396168ec68a9a4d93fd7ee0d2db5d8127b0605ba34614ff39e3f6919e1ae15bb93e593d0a3a
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
@@ -23,7 +23,7 @@ class WcoEmail::MessageStub
23
23
  field :status, default: STATUS_PENDING
24
24
  scope :pending, ->{ where( status: STATUS_PENDING ) }
25
25
 
26
- field :bucket # 'ish-ses', 'ish-ses-2024'
26
+ field :bucket # 'ish-ses' (current), 'ish-ses-2024'
27
27
 
28
28
  field :object_key
29
29
  validates :object_key, presence: true, uniqueness: true
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.174
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-08-23 00:00:00.000000000 Z
11
+ date: 2024-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ahoy_matey