bullet_train 1.9.0 → 1.11.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: 892c29ff71cfaa92f465dcdda297c34c767123aebc2a9b9950b04136dd327eef
4
+ data.tar.gz: be30f624783ec02d7924d7312c0697097e1f968cc28e34ca878d86add2d2cc40
5
5
  SHA512:
6
- metadata.gz: f23b4c570bef9b014f79945ce98740c926e0e3496b2e07151bcf4b0f81bbb2a83c1c5809d4299e5cf9e8fb9747dd138e65bcd258f82543cd98ba2c4ac1b16ad3
7
- data.tar.gz: 309b914568e1f0dbb6569dbaa31b0a36d1782f165a60e0df17a9ecd3721a175c78754d8e48e2be0491dfa9c808086da7908484c4e43191406c3e77d4935313aa
6
+ metadata.gz: a2f4d79b3f5dcbcc89d7058836bbb7ff22c41b47917a82caadb051f11fd4cfc03e34f7bedb1ea94ed538525d60c0be9f0c09373c920f3a8fded04659944142f3
7
+ data.tar.gz: 0eb2e4f26cb7eb9f84523b01717698e5f672d74fa2c5e3b319b7258b0c0318c76d33828ce520e768c137c1c6bc9351b7db5a72c833b5e90ffcb692fafe5ae7cb
@@ -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
data/docs/upgrades.md CHANGED
@@ -14,8 +14,49 @@
14
14
 
15
15
  ## The Stepwise Upgrade Method
16
16
 
17
- This method will ensure that the version of the Bullet Train gems that your app uses will stay in sync with the application framework provided by the starter repo.
18
- If you've ever upgraded a Rails app from version to version this process should feel fairly similar.
17
+ This method will ensure that the version of the Bullet Train gems that your app uses will stay in sync
18
+ with the application framework provided by the starter repo. If you've ever upgraded a Rails app from
19
+ version to version this process should feel fairly similar.
20
+
21
+ We recommend gradually upgrading one version at a time. This makes it relatively easy to pinpoint any
22
+ specific changes that may cause problems with your app. Trying to jump a bunch of versions at once can
23
+ make it hard to figure out exactly where problems are coming from.
24
+
25
+ The basic idea is that if you're on `1.4.0` you should upgrade next to `1.4.1`, run your tests, deploy
26
+ those changes and make sure things are working well. Then upgrade to `1.4.2` etc... If you update regularly
27
+ then each individual update should be relatively small.
28
+
29
+ For performing the upgrade you have two options:
30
+
31
+ * [Use the GitHub Action we provide to create an upgrade Pull Request](./upgrades#github-action)
32
+ * [Performa a manual upgrade via git](./upgrades#manual-upgrade)
33
+
34
+ ## GitHub Action
35
+
36
+ First go to the "Actions" tab on your project and then click on the "↗️ Create Bullet Train Upgrade PR" link on the left.
37
+
38
+ ![Find the GitHub Action](https://bullettrain.co/upgrade-images/1-find-action.png)
39
+
40
+ Then on the right side of the page click the "Run workflow" button and enter the target version. `1.4.1` for instance.
41
+ If you don't enter a version number then the action will target the latest version available on GitHub.
42
+
43
+ ![Run the GitHub Action](https://bullettrain.co/upgrade-images/2-run-action.png)
44
+
45
+ A few seconds after you click the green "Run workflow" button you should see a new action running.
46
+
47
+ ![Running Action](https://bullettrain.co/upgrade-images/3-running-action.png)
48
+
49
+ Once the action has completed you should have a new Pull Request that will perform the upgrade.
50
+
51
+ ![Upgrade PR](https://bullettrain.co/upgrade-images/4-upgrade-pr.png)
52
+
53
+ You should review the contents of the pull request, run the tests, and pull down the branch to run it locally.
54
+
55
+ [Here's a sample of the kind of Pull Request that you'll get. This is from a recent upgrade of the Bullet Train demo site.](https://github.com/bullet-train-co/bullet_train-demo_site/pull/47)
56
+
57
+ The GitHub action is basically an automated version of the manual upgrade process described below.
58
+
59
+ ## Manual Upgrade
19
60
 
20
61
  ## Pulling Updates from the Starter Repository
21
62
 
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.9.0"
2
+ VERSION = "1.11.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.11.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-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: bullet_train-routes
112
+ name: bullet_train-fields
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -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