avo 3.33.0 → 3.33.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ad2e1923fc6764c771a4fe15e90f8a976d5b2013973d1e535b9ae3dcc78a235
4
- data.tar.gz: d71cd3e311448cb5f2da3f0ef17c18793259a4b7bb9b797962e785f166794665
3
+ metadata.gz: 251f54888bd2cc84f404a0d397b769ab791353f9f2786b3355fbecdc2f258a6c
4
+ data.tar.gz: 74010e8c3b84085a6b52b9b47f396aadeb7beea85b43eeb2f9246a5abe15605d
5
5
  SHA512:
6
- metadata.gz: 7c4a5642e206e5945ef16e5a8063fe20f50784a7c0b83646ff48081b784b401562d69ecc4ca1c6e304f895dfa2dd7bb0e5fc9e6abb6683992301502a62554f04
7
- data.tar.gz: e483b128f7d00226beb7366209bde112ede887b9442dbbad4a963f8e83f729938ac597ec30a7a1445af01e3910f4b06229a5c1fd0898796793e181a35ab82bf1
6
+ metadata.gz: ca5a2bb0a37b43afeb76fed59e7ace41c2ba8b2e7c8aeb498d404f82dd5bced610bb83c109ad86287f265c6ecd72615612318cb456b4cabe5147e5b391e067de
7
+ data.tar.gz: bda30f213366f943b6cae6c7c7b89a09a249b8001145b52907f7e02b0941e61466b6fc50e2bd3e9d0c9771e44ad6d35dec2710e26661c874e299609c7df8bcbb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (3.33.0)
4
+ avo (3.33.1)
5
5
  actionview (>= 6.1)
6
6
  active_link_to
7
7
  activerecord (>= 6.1)
@@ -223,6 +223,13 @@ module Avo
223
223
 
224
224
  def _authenticate!
225
225
  instance_eval(&Avo.configuration.authenticate)
226
+ return if performed?
227
+
228
+ # `?set_locale=` changes the locale for every user, so only a request the
229
+ # authenticate block let through may store it. Kept here, not in its own
230
+ # callback, so a controller that skips this one cannot store it either.
231
+ locale = available_locale(params[:set_locale])
232
+ Avo.configuration.locale = locale if locale
226
233
  end
227
234
 
228
235
  def render_unauthorized(exception)
@@ -259,21 +266,25 @@ module Avo
259
266
  @resource.form_scope
260
267
  end
261
268
 
262
- # Sets the locale set in avo.rb initializer or if to something that the user set using the `?set_locale=pt-BR` param
269
+ # Sets the locale set in avo.rb initializer or if to something that the user set using the `?set_locale=pt-BR` param.
270
+ # Unknown locales are ignored: I18n.with_locale raises InvalidLocale on them.
263
271
  def set_avo_locale(&action)
264
- locale = Avo.configuration.default_locale
265
-
266
- if params[:set_locale].present?
267
- locale = params[:set_locale]
268
- Avo.configuration.locale = locale
269
- end
272
+ locale = available_locale(params[:set_locale]) || Avo.configuration.default_locale
270
273
 
271
274
  I18n.with_locale(locale, &action)
272
275
  end
273
276
 
274
277
  # Temporary set the locale and reverting at the end of the request.
275
278
  def set_force_locale(&action)
276
- I18n.with_locale(params[:force_locale], &action)
279
+ locale = available_locale(params[:force_locale])
280
+ return yield if locale.nil?
281
+
282
+ I18n.with_locale(locale, &action)
283
+ end
284
+
285
+ def available_locale(value)
286
+ value = value.to_s
287
+ value if value.present? && I18n.locale_available?(value)
277
288
  end
278
289
 
279
290
  def set_sidebar_open
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "3.33.0" unless const_defined?(:VERSION)
2
+ VERSION = "3.33.1" unless const_defined?(:VERSION)
3
3
  end
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.33.0
4
+ version: 3.33.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
8
8
  - Mihai Marin
9
9
  - Paul Bob
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2026-10-14 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: activerecord
@@ -1110,8 +1109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1110
1109
  - !ruby/object:Gem::Version
1111
1110
  version: '0'
1112
1111
  requirements: []
1113
- rubygems_version: 3.5.22
1114
- signing_key:
1112
+ rubygems_version: 4.0.1
1115
1113
  specification_version: 4
1116
1114
  summary: Admin panel framework and Content Management System for Ruby on Rails.
1117
1115
  test_files: []