trek 2.3.1 → 2.3.2
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/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/app/controllers/concerns/trek/scopes.rb +9 -2
- data/docs/reference/controllers.md +1 -1
- data/lib/generators/trek/templates/spec/requests/admin/user_password_resets_spec.rb +12 -0
- data/lib/generators/trek/templates/spec/requests/admin/user_sessions_spec.rb +6 -0
- data/lib/generators/trek/templates/views/admin/user_password_resets/edit.html.slim +1 -1
- data/lib/generators/trek/templates/views/admin/user_password_resets/new.html.slim +1 -1
- data/lib/generators/trek/templates/views/admin/user_sessions/new.html.slim +1 -1
- data/lib/trek/version.rb +1 -1
- data/package.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3749a9dc01b378419fbbaacdbf9e8251100d9bdd6281b308a9d44cf9dd18d182
|
|
4
|
+
data.tar.gz: d61b12a1f80494ebaf0c664bbfcfdf2d24b682632ef9c268117b4de23fb7e1b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9083e34869370a8b22b69a8c9aadb3f404e74f9d4b32097c48f51ad024d750aed71769a203112b78f19b74c7489ec46f512340bdd728dfebfef76f6bd37ec27
|
|
7
|
+
data.tar.gz: 9800e5d16a2639e2a51644ce67bb488bd1e4c34930867f08311b7df56992dd7dcf42b37a926d4097a5bd5f9a1a59bc476f5d2c70091b9eb2f54efc11ee14dcfc
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [2.3.2] - 2026-10-02
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **Security:** `Trek::Scopes#apply_scopes` called any name found in `params[:scopes]` that the relation answered to, not only the controller's `available_scopes`, which let a request run unintended methods on the listed records. Only the names in `available_scopes` are applied now; others are ignored. **Upgrade note:** update Trek as soon as possible. A controller passing `apply_scopes` a scope name it does not list in `available_scopes` must add it there.
|
|
8
|
+
- The generated admin sign-in, password reset request and new password pages rendered their actions with the default aspect of `Trek::Form::ActionsComponent`, whose sticky action bar (top margin, padding, background) is meant for edit forms: inside those small cards, the button and the « forgotten password » link sat in a padded bar. They now use the `seamless` aspect. **Upgrade note:** in apps generated before this version, pass `aspect: :seamless` to `Trek::Form::ActionsComponent.new` in `app/views/admin/user_sessions/new.html.slim` and `app/views/admin/user_password_resets/{new,edit}.html.slim`.
|
|
9
|
+
|
|
3
10
|
## [2.3.1] - 2026-10-02
|
|
4
11
|
|
|
5
12
|
### Changed
|
data/Gemfile.lock
CHANGED
|
@@ -19,8 +19,13 @@ module Trek
|
|
|
19
19
|
def apply_scopes(scope, filters)
|
|
20
20
|
return scope if filters.blank?
|
|
21
21
|
|
|
22
|
+
# Only the controller's own scopes: the names come from the request, and a relation also
|
|
23
|
+
# answers to destroy_all, delete_all…
|
|
24
|
+
allowed = available_scopes.map(&:to_s)
|
|
25
|
+
|
|
22
26
|
filters.each do |filter, value|
|
|
23
27
|
next if value.blank?
|
|
28
|
+
next unless allowed.include?(filter.to_s)
|
|
24
29
|
|
|
25
30
|
scope = scope.public_send(filter) if scope.respond_to?(filter)
|
|
26
31
|
end
|
|
@@ -31,7 +36,7 @@ module Trek
|
|
|
31
36
|
def apply_scopes!
|
|
32
37
|
@scopes_applied = true
|
|
33
38
|
@unscoped_objects = @objects
|
|
34
|
-
@objects = apply_scopes(@objects,
|
|
39
|
+
@objects = apply_scopes(@objects, scope_params)
|
|
35
40
|
scope_counts
|
|
36
41
|
end
|
|
37
42
|
|
|
@@ -65,8 +70,10 @@ module Trek
|
|
|
65
70
|
[]
|
|
66
71
|
end
|
|
67
72
|
|
|
73
|
+
# The requested scopes, permitted to the available ones; nil when params[:scopes] isn't a hash
|
|
68
74
|
def scope_params
|
|
69
|
-
params[:scopes]
|
|
75
|
+
scopes = params[:scopes]
|
|
76
|
+
scopes.permit(*available_scopes) if scopes.respond_to?(:permit)
|
|
70
77
|
end
|
|
71
78
|
|
|
72
79
|
private def ensure_scopes_applied
|
|
@@ -75,7 +75,7 @@ with the chosen filter:
|
|
|
75
75
|
### Scopes
|
|
76
76
|
|
|
77
77
|
`Trek::Scopes` filters by **named model scopes** rather than raw attributes. Declare the allowed scopes via
|
|
78
|
-
`available_scopes`, then call `apply_scopes!` in your `index
|
|
78
|
+
`available_scopes`, then call `apply_scopes!` in your `index`; any other name in `params[:scopes]` is ignored. It also exposes `scope_counts` and
|
|
79
79
|
`unscoped_objects` helpers (the per-scope match counts and the pre-scope collection) for building scope tabs:
|
|
80
80
|
|
|
81
81
|
```ruby
|
|
@@ -9,6 +9,12 @@ RSpec.describe "Admin password resets", type: :request do
|
|
|
9
9
|
expect(response).to have_http_status(:ok)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
it "keeps the reset request actions in the card, out of the sticky action bar" do
|
|
13
|
+
get new_admin_user_password_reset_path
|
|
14
|
+
|
|
15
|
+
expect(response.body).to include("c-trek--form--actions-aspect-seamless")
|
|
16
|
+
end
|
|
17
|
+
|
|
12
18
|
it "emails a reset link to a privileged user" do
|
|
13
19
|
expect { post admin_user_password_resets_path, params: { email: editor.email } }
|
|
14
20
|
.to have_enqueued_mail(Admin::PasswordsMailer, :reset)
|
|
@@ -31,6 +37,12 @@ RSpec.describe "Admin password resets", type: :request do
|
|
|
31
37
|
expect(response).to have_http_status(:ok)
|
|
32
38
|
end
|
|
33
39
|
|
|
40
|
+
it "keeps the new password actions in the card, out of the sticky action bar" do
|
|
41
|
+
get edit_admin_user_password_reset_path(editor.password_reset_token)
|
|
42
|
+
|
|
43
|
+
expect(response.body).to include("c-trek--form--actions-aspect-seamless")
|
|
44
|
+
end
|
|
45
|
+
|
|
34
46
|
it "renders the new password form from an invitation link" do
|
|
35
47
|
get edit_admin_user_password_reset_path(editor.generate_token_for(:invite))
|
|
36
48
|
|
|
@@ -9,6 +9,12 @@ RSpec.describe "Admin sign-in", type: :request do
|
|
|
9
9
|
expect(response).to have_http_status(:ok)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
it "keeps the sign-in actions in the card, out of the sticky action bar" do
|
|
13
|
+
get new_admin_user_session_path
|
|
14
|
+
|
|
15
|
+
expect(response.body).to include("c-trek--form--actions-aspect-seamless")
|
|
16
|
+
end
|
|
17
|
+
|
|
12
18
|
it "signs a privileged user in and opens the dashboard" do
|
|
13
19
|
post admin_user_session_path, params: { email: editor.email, password: users.password }
|
|
14
20
|
follow_redirect!
|
data/lib/trek/version.rb
CHANGED
data/package.json
CHANGED