Skip to content

Commit

Permalink
🧹 Attempting to find and squash bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyf committed Dec 22, 2023
1 parent 488208b commit 1476b2b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ gem 'selenium-webdriver', '4.8.1', group: %i[test]
gem 'shoulda-matchers', '~> 4.0', group: %i[test]
gem 'sidekiq', "< 7.0" # sidekiq 7 requires upgrade to redis 6
gem 'simplecov', require: false, group: %i[development test]
gem 'solargraph', group: %i[development]
gem 'solr_wrapper', '~> 2.0', group: %i[development test]
gem 'spring', '~> 1.7', group: %i[development]
gem 'spring-watcher-listen', '~> 2.0.0', group: %i[development]
Expand Down
27 changes: 27 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ GEM
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
backport (1.2.0)
bagit (0.4.6)
docopt (~> 0.5.0)
validatable (~> 1.6)
Expand All @@ -261,6 +262,7 @@ GEM
i18n
bcp47_spec (0.2.1)
bcrypt (3.1.20)
benchmark (0.3.0)
benchmark_methods (0.7)
better_html (2.0.2)
actionview (>= 6.0)
Expand Down Expand Up @@ -511,6 +513,7 @@ GEM
dry-initializer (~> 3.0)
dry-schema (>= 1.12, < 2)
zeitwerk (~> 2.6)
e2mmap (0.1.0)
easy_translate (0.5.1)
thread
thread_safe
Expand Down Expand Up @@ -683,6 +686,7 @@ GEM
activesupport (>= 4)
iso-639 (0.3.6)
iso8601 (0.9.1)
jaro_winkler (1.5.6)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -727,6 +731,10 @@ GEM
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_list (1.2.1)
latex-decode (0.4.0)
launchy (2.5.2)
Expand Down Expand Up @@ -1101,6 +1109,8 @@ GEM
actionpack (>= 5.2)
railties (>= 5.2)
retriable (3.1.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.2.6)
riiif (2.4.0)
deprecation (>= 1.0.0)
Expand Down Expand Up @@ -1236,6 +1246,21 @@ GEM
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
solargraph (0.48.0)
backport (~> 1.2)
benchmark
bundler (>= 1.17.2)
diff-lcs (~> 1.4)
e2mmap
jaro_winkler (~> 1.5)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1)
parser (~> 3.0)
reverse_markdown (>= 1.0.5, < 3)
rubocop (>= 0.52)
thor (~> 1.0)
tilt (~> 2.0)
yard (~> 0.9, >= 0.9.24)
solr_wrapper (2.2.0)
faraday
retriable
Expand Down Expand Up @@ -1364,6 +1389,7 @@ GEM
psych (>= 3.3)
rdf (~> 3.2, >= 3.2.9)
rdf-xsd (~> 3.2)
yard (0.9.34)
zeitwerk (2.6.12)
zlib (2.1.1)

Expand Down Expand Up @@ -1458,6 +1484,7 @@ DEPENDENCIES
shoulda-matchers (~> 4.0)
sidekiq (< 7.0)
simplecov
solargraph
solr_wrapper (~> 2.0)
spring (~> 1.7)
spring-watcher-listen (~> 2.0.0)
Expand Down
5 changes: 3 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def site_roles=(roles)
# u.hyrax_groups
# => [#<Hyrax::Group id: 2, name: "registered", description: nil,...>]
def hyrax_groups
roles.where(name: 'member', resource_type: 'Hyrax::Group').map(&:resource).uniq
# Why compact? In theory we shouldn't need this. But in tests we're seeing a case
roles.where(name: 'member', resource_type: 'Hyrax::Group').map(&:resource).uniq.compact
end

# Override method from hydra-access-controls v11.0.0 to use Hyrax::Groups.
Expand All @@ -114,7 +115,7 @@ def groups
# Looking at `#hyrax_groups` method, it's unclear how we'd find `nil`.
#
# Perhaps the `Hyrax::Group` is in a tenant and `Role` is not? Hmm.
raise "Hyrax::Groups: #{roles.where(name: 'member', resource_type: 'Hyrax::Group').map(&:resource).inspect}\nRoles: #{roles.all.inspect}"
raise "Hyrax::Groups: #{roles.where(name: 'member', resource_type: 'Hyrax::Group').all.inspect}\nRoles: #{roles.all.inspect}"
end

# NOTE: This is an alias for #groups to clarify what the method is doing.
Expand Down

0 comments on commit 1476b2b

Please sign in to comment.