ish_models 0.0.33.207 → 0.0.33.209

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: 55cb65ec961e228555cc0e988463cad24df9b5a950d648ce46ad44430094543e
4
- data.tar.gz: e42adfd217b60685cf391b15277e0bc2d75d712065fd0feade2e530e80410170
3
+ metadata.gz: a1d881ee26c3ebc1d7ebd70d700f2f2bb48698e1cf0dc3bccaa892f5c66a05d3
4
+ data.tar.gz: afb800653429e3c29209199d4da42b566b4a1acf5059e2c03c5d8ae174d06ef2
5
5
  SHA512:
6
- metadata.gz: 1892c58dc3b6cb61cbe52bdb2df0cf5d17114f3e921f9db16952e264b46414153630fb9b793141f8c7269808cd3b86f83cea5be33638e2369661c7b0a254b4a5
7
- data.tar.gz: d25fa7fc56d4384233dabf83a6a5ffce31238024dfd6fc997c5aab710cf30f0b34e71f44da650919053f4d67afa362d78970b25eef87dff26a5c46f47456e5c4
6
+ metadata.gz: ba5ce659689e9efd867bdd423262afcc4f5a70ab19f5cd1f0d4e6a39a30b3ded49eee02973911d882b6156c265282f103b806a4e6068b5231ec0fad28727c573
7
+ data.tar.gz: 7c6745e4f7a230fea262b2f9f99da14dd36872afe1bd6ac16ac93f98a932648ae34dc719e87fbe13f9d2fa9b0327182c755ae845367efb9d7dde32bb2a418802
@@ -39,7 +39,7 @@ class Office::EmailConversation
39
39
  when 'String'
40
40
  tag = WpTag.emailtag(tag)
41
41
  else
42
- throw "#add_tag expects a WpTag or string (eg WpTag::EMAILTAG_INBOX) as the only parameter."
42
+ throw "#add_tag expects a WpTag or string (eg WpTag::INBOX) as the only parameter."
43
43
  end
44
44
  self[:wp_term_ids] = ( [ tag.id ] + self[:wp_term_ids] ).uniq
45
45
  self.save!
@@ -52,19 +52,24 @@ class Office::EmailConversation
52
52
  when 'String'
53
53
  tag = WpTag.emailtag(tag)
54
54
  else
55
- throw "#remove_tag expects a WpTag or string (eg WpTag::EMAILTAG_INBOX) as the only parameter."
55
+ throw "#remove_tag expects a WpTag or string (eg WpTag::INBOX) as the only parameter."
56
56
  end
57
- self[:wp_term_ids].delete( tag.id )
58
- self.save!
59
- end
60
-
61
- def self.in_inbox
62
- ::Office::EmailConversation.where( :wp_term_ids => WpTag.email_inbox_tag.id ).order_by( latest_at: :desc )
57
+ self[:wp_term_ids] = self[:wp_term_ids] - [ tag.id ]
58
+ out = self.save!
59
+ out
63
60
  end
61
+ def rmtag tag; remove_tag tag; end
64
62
 
65
- def self.in_no_trash
66
- trash_id = WpTag.emailtag('trash').id
67
- return ::Office::EmailConversation.where( :wp_term_ids.ne => trash_id ).order_by( latest_at: :desc )
63
+ def self.not_in_emailtag which
64
+ case which.class.name
65
+ when 'String'
66
+ tag_id = WpTag.emailtag(which).id
67
+ when 'WpTag'
68
+ tag_id = which.id
69
+ else
70
+ throw "unsupported in #not_in_emailtag: #{which}"
71
+ end
72
+ return ::Office::EmailConversation.where( :wp_term_ids.ne => tag_id ).order_by( latest_at: :desc )
68
73
  end
69
74
 
70
75
  def self.in_emailtag which
@@ -10,7 +10,7 @@ class Office::EmailMessage
10
10
 
11
11
  field :message_id, type: :string # MESSAGE-ID
12
12
  validates_uniqueness_of :message_id
13
- index({ message_id: 1 }, { unique: true, name: "message_id_idx" })
13
+ index({ message_id: 1 }, { unique: true, name: "id_idx" })
14
14
 
15
15
  field :in_reply_to_id, type: :string
16
16
 
@@ -64,7 +64,7 @@ class Office::EmailMessage
64
64
  email_conversation
65
65
  end
66
66
 
67
- ## @TODO: reimplement, look at footer instead.
67
+ ## @TODO: reimplement
68
68
  def name
69
69
  return 'associate'
70
70
  # from[0].split('@')[0].upcase
@@ -77,23 +77,12 @@ class Office::EmailMessage
77
77
  def apply_filter filter
78
78
  case filter.kind
79
79
  when ::Office::EmailFilter::KIND_SKIP_INBOX
80
- self.remove_tag( ::WpTag.email_inbox_tag )
80
+ self.remove_tag( WpTag::INBOX )
81
81
  when ::Office::EmailFilter::KIND_AUTORESPOND
82
82
  Ish::EmailContext.create({
83
83
  email_template: ::Tmpl.find_by_slug( filter.email_template_slug ),
84
84
  lead: lead,
85
85
  })
86
- # when 'autorespond-remind'
87
- # Office::EmailAction.create({
88
- # tmpl_slug: 'require-sign-nda',
89
- # next_in_days: -> { rand(1..5) },
90
- # next_at_time: ->{ rand(8..16).hours + rand(1..59).minutes },
91
- # next_action: 're-remind-sign-nda',
92
- # })
93
- # Ish::EmailContext.create({
94
- # email_template: ::Tmpl.find_by_slug( filter.email_template_slug ),
95
- # lead: lead,
96
- # })
97
86
  else
98
87
  raise "unknown filter kind: #{filter.kind}"
99
88
  end
data/lib/video.rb CHANGED
@@ -27,28 +27,23 @@ class Video
27
27
  end
28
28
 
29
29
  field :is_public, :type => Boolean, :default => false
30
- field :is_feature, :type => Boolean, :default => false
31
30
 
32
31
  field :x, type: Float
33
32
  field :y, type: Float
34
33
  field :z, type: Float
35
34
 
36
- field :lang, :type => String, :default => 'en'
37
-
38
35
  field :youtube_id
39
36
  validates_uniqueness_of :youtube_id, allow_blank: true, case_sensitive: false
40
37
  before_save { youtube_id.present? || youtube_id = nil }
41
38
 
42
39
  belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile', :inverse_of => :videos
43
40
 
41
+ index({ is_trash: 1, user_profile_id: 1, created_at: 1 }, { name: 'idx1' })
42
+
44
43
  def self.list
45
44
  [['', nil]] + Video.unscoped.order_by( :created_at => :desc ).map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
46
45
  end
47
46
 
48
-
49
- field :issue
50
- field :subhead
51
-
52
47
  has_mongoid_attached_file :video,
53
48
  # styles: { :thumb => { geometry: '192x108', format: 'jpeg' }, },
54
49
  # processors: [ :transcoder ],
@@ -94,3 +89,11 @@ class Video
94
89
 
95
90
 
96
91
  end
92
+
93
+
94
+ =begin
95
+ field :issue
96
+ field :subhead
97
+ field :is_feature, :type => Boolean, :default => false
98
+ field :lang, :type => String, :default => 'en'
99
+ =end
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.207
4
+ version: 0.0.33.209
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox