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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcec0bd91adffafd52e55f0eecca9146046813df1fdde5252affd856a4584bf8
4
- data.tar.gz: c84ee2c8fac6c7ac3faa00e7de4e4ae43ec4ab7bbb93b7213e466881e9ef8257
3
+ metadata.gz: c419936bf15b299264f23527fa0d74f57860c031e279ada4cb04608a7d55e9d9
4
+ data.tar.gz: a6f877818f76baf0c43ad806109b981ba63e896ab53dcd01c6b855baf708f439
5
5
  SHA512:
6
- metadata.gz: 15c65b27a87cc9e5e4b9d3d4e21050b3fcca50acffc9d0a36151f03b3d569a2cec51e15c9c1153454153518698ba189cb9f4c2bee54dd282305be2c5c60199f3
7
- data.tar.gz: c5631b4d32836f90b2e4eb90ec982e331b2ffef76f0dafbd819b5779259d17941e8277f548c56260d85750d5bbc2317eb543bae1ab223bdf56981b6eb4c8ca9d
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
@@ -1,3 +1,3 @@
1
1
  module VenusMediaLibrary
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
@@ -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 = ->(user) { user.admin? }
86
+ @admin = DEFAULT_ADMIN
75
87
  @asset_scope = ->(scope) { scope }
76
88
  @legacy_blob_scope = ->(scope) { scope.none }
77
89
  @static_assets = -> { [] }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: venus_media_library
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Good Works On Earth