bullet_train 1.9.0 → 1.10.0

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: 7bb17249290fdefef282f1c6841c0f3b3cce6d383fc567eb1cbb8859bdcc8456
4
- data.tar.gz: d051b05577b95efc6007d0bbc4286304801ec0ab22f00d29dcab71348a4f242f
3
+ metadata.gz: 476b5c3d4c9b745aa40ae138671c83c98654acd7ebc3070928778413313f9f4f
4
+ data.tar.gz: 472afd1105a7d81eca8465b01771591c84b10da24c8df90772785303c71a7d88
5
5
  SHA512:
6
- metadata.gz: f23b4c570bef9b014f79945ce98740c926e0e3496b2e07151bcf4b0f81bbb2a83c1c5809d4299e5cf9e8fb9747dd138e65bcd258f82543cd98ba2c4ac1b16ad3
7
- data.tar.gz: 309b914568e1f0dbb6569dbaa31b0a36d1782f165a60e0df17a9ecd3721a175c78754d8e48e2be0491dfa9c808086da7908484c4e43191406c3e77d4935313aa
6
+ metadata.gz: 4749dedcfb1e22982f6288e65f16deb037a3647041cc62027e85af3f6ce152a86298c65f4351c0b1f8ad6730196ab8781433f75402059dabebfdae24fd6d281b
7
+ data.tar.gz: 25a8e4e1fb083356e8511728c7defe161070561a6d80649ef350806b7578b60833fd14c7867d3b97ab5ccb96bcfd7dfa7c922a79ddf26a4a6edfb0aab4046a6c
@@ -32,6 +32,8 @@ module Memberships::Base
32
32
 
33
33
  after_commit :publish_changed_quantity
34
34
 
35
+ after_create :set_team_time_zone, if: :is_first_membership?
36
+
35
37
  after_validation :remove_user_profile_photo, if: :user_profile_photo_removal?
36
38
 
37
39
  scope :excluding_platform_agents, -> { where(platform_agent_of: nil) }
@@ -157,5 +159,13 @@ module Memberships::Base
157
159
  ActiveSupport::Notifications.instrument("memberships.quantity-changed", {team:})
158
160
  end
159
161
 
162
+ def set_team_time_zone
163
+ team.set_time_zone_from_user(user)
164
+ end
165
+
166
+ def is_first_membership?
167
+ team.memberships.count == 1 && team.memberships.first.id == id
168
+ end
169
+
160
170
  ActiveSupport.run_load_hooks :bullet_train_memberships_base, self
161
171
  end
@@ -25,6 +25,18 @@ module Teams::Base
25
25
  validates :time_zone, inclusion: {in: ActiveSupport::TimeZone.all.map(&:name)}, allow_nil: true
26
26
  end
27
27
 
28
+ def initialize(attributes = nil)
29
+ super
30
+ self.time_zone = "UTC" if time_zone.blank?
31
+ end
32
+
33
+ def set_time_zone_from_user(user)
34
+ if time_zone.blank? || time_zone == "UTC"
35
+ self.time_zone = user.time_zone if user.time_zone.present?
36
+ save
37
+ end
38
+ end
39
+
28
40
  def platform_agent_access_tokens
29
41
  Platform::AccessToken.joins(:application).where(resource_owner_id: users.where.not(platform_agent_of_id: nil), application: {team: nil})
30
42
  end
@@ -153,7 +153,7 @@ module Users::Base
153
153
  end
154
154
 
155
155
  def set_teams_time_zone
156
- teams.where(time_zone: nil).each do |team|
156
+ teams.where(time_zone: [nil, "UTC"]).each do |team|
157
157
  team.update(time_zone: time_zone) if team.users.count == 1
158
158
  end
159
159
  end
@@ -48,6 +48,7 @@ en:
48
48
  creator: Bullet Train, Inc.
49
49
  time_ago: "%{time} ago"
50
50
  never: Never
51
+ not_set: Not Set
51
52
  buttons:
52
53
  other: Other
53
54
  debug: Debug
@@ -0,0 +1,37 @@
1
+ default:
2
+ models:
3
+ Team: read
4
+ Document: read
5
+ Membership:
6
+ - read
7
+ - search
8
+
9
+ crud_role:
10
+ models:
11
+ Team: crud
12
+
13
+ editor:
14
+ models:
15
+ Scaffolding::AbsolutelyAbstract::CreativeConcept:
16
+ - read
17
+ - update
18
+
19
+ manager:
20
+ includes:
21
+ - editor
22
+
23
+ supervisor:
24
+ includes:
25
+ - manager
26
+
27
+ admin:
28
+ includes:
29
+ - editor
30
+ manageable_roles:
31
+ - admin
32
+ - editor
33
+ models:
34
+ Team: manage
35
+ Membership: manage
36
+ Document: manage
37
+ Scaffolding::AbsolutelyAbstract::CreativeConcept: manage
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.9.0"
2
+ VERSION = "1.10.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-19 00:00:00.000000000 Z
11
+ date: 2024-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -486,6 +486,20 @@ dependencies:
486
486
  - - ">="
487
487
  - !ruby/object:Gem::Version
488
488
  version: '0'
489
+ - !ruby/object:Gem::Dependency
490
+ name: pg
491
+ requirement: !ruby/object:Gem::Requirement
492
+ requirements:
493
+ - - "~>"
494
+ - !ruby/object:Gem::Version
495
+ version: '1.3'
496
+ type: :development
497
+ prerelease: false
498
+ version_requirements: !ruby/object:Gem::Requirement
499
+ requirements:
500
+ - - "~>"
501
+ - !ruby/object:Gem::Version
502
+ version: '1.3'
489
503
  - !ruby/object:Gem::Dependency
490
504
  name: devise-pwned_password
491
505
  requirement: !ruby/object:Gem::Requirement
@@ -680,6 +694,7 @@ files:
680
694
  - config/locales/en/teams.en.yml
681
695
  - config/locales/en/users.en.yml
682
696
  - config/locales/localization.en.yml
697
+ - config/models/roles.yml
683
698
  - config/routes.rb
684
699
  - db/migrate/20161115160419_devise_create_users.rb
685
700
  - db/migrate/20161116003852_add_api_key_to_user.rb