venus_media_library 1.1.1 → 1.1.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 +9 -0
- data/lib/venus_media_library/version.rb +1 -1
- data/lib/venus_media_library.rb +13 -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: c419936bf15b299264f23527fa0d74f57860c031e279ada4cb04608a7d55e9d9
|
|
4
|
+
data.tar.gz: a6f877818f76baf0c43ad806109b981ba63e896ab53dcd01c6b855baf708f439
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d4cd43c0e4b6945eac1bc77b9009b949e3b42bfcb3e9d241f1dc1fad99e5a623a9c0947525e6216ba5edf1d952fb0560405397b56600dc11748da1c89eb701b
|
|
7
|
+
data.tar.gz: 3c7794fb4b5f9ca228a12c8f78cb526c5e8d5a580beaeb6f7316cdc22fb464b46907dff569bb5b799419a5b1c9ff2e91b79db9040b134de29cb88e1a2f707596
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ All notable changes to this project are documented here. The format is based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres
|
|
5
5
|
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.1.2] - 2026-08-19
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- The default admin predicate now recognises both the `admin?` **and**
|
|
11
|
+
`is_admin?` conventions (and returns non-admin for `nil`) instead of assuming
|
|
12
|
+
`admin?`. A host whose user model uses `is_admin?` no longer needs to set
|
|
13
|
+
`config.admin` just to avoid a `NoMethodError` from the role-gated library nav.
|
|
14
|
+
Any other scheme remains fully configurable via `config.admin`.
|
|
15
|
+
|
|
7
16
|
## [1.1.1] - 2026-08-19
|
|
8
17
|
|
|
9
18
|
### Fixed
|
data/lib/venus_media_library.rb
CHANGED
|
@@ -62,6 +62,18 @@ module VenusMediaLibrary
|
|
|
62
62
|
# does not enumerate a cloud bucket or expose storage-provider credentials.
|
|
63
63
|
attr_accessor :cloud_assets
|
|
64
64
|
|
|
65
|
+
# Default admin predicate. A gem shouldn't break just because a host app names
|
|
66
|
+
# its flag differently, so try the two common conventions — `admin?` then
|
|
67
|
+
# `is_admin?` — and fall back to non-admin. Hosts with any other scheme set
|
|
68
|
+
# their own `config.admin = ->(user) { ... }`.
|
|
69
|
+
DEFAULT_ADMIN = lambda do |user|
|
|
70
|
+
return false if user.nil?
|
|
71
|
+
return !!user.admin? if user.respond_to?(:admin?)
|
|
72
|
+
return !!user.is_admin? if user.respond_to?(:is_admin?)
|
|
73
|
+
|
|
74
|
+
false
|
|
75
|
+
end
|
|
76
|
+
|
|
65
77
|
def initialize
|
|
66
78
|
@allowed_content_types = %w[image/png image/jpeg image/jpg image/gif image/webp image/svg+xml]
|
|
67
79
|
@thumbnail_size = [ 300, 300 ]
|
|
@@ -71,7 +83,7 @@ module VenusMediaLibrary
|
|
|
71
83
|
@url_type = :redirect
|
|
72
84
|
@authenticate_with = nil
|
|
73
85
|
@current_user = -> { current_user }
|
|
74
|
-
@admin =
|
|
86
|
+
@admin = DEFAULT_ADMIN
|
|
75
87
|
@asset_scope = ->(scope) { scope }
|
|
76
88
|
@legacy_blob_scope = ->(scope) { scope.none }
|
|
77
89
|
@static_assets = -> { [] }
|