Skip to content

Commit

Permalink
Fix #28
Browse files Browse the repository at this point in the history
  • Loading branch information
ahukkanen committed Nov 27, 2019
1 parent a213b5e commit 5d7dca1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/decidim/term_customizer/context/controller_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ def resolve!
# E.g. at the participatory process controller the
# `decidim.current_participatory_space` environment variable has not
# been set. Therefore, we need to fetch it directly from the
# controller using its private method.
@space =
if controller.respond_to?(:current_participatory_space, true)
controller.send(:current_participatory_space)
else
env["decidim.current_participatory_space"]
end
# controller using its private method. In some edge cases this may not
# be implemented (https://github.com/mainio/decidim-module-term_customizer/issues/28)
# in which case we do not have access to the participatory space.
if controller.respond_to?(:current_participatory_space, true)
@space = controller.try(
:current_participatory_space
)
end
@space ||= env["decidim.current_participatory_space"]

@component = env["decidim.current_component"]
end
Expand Down

0 comments on commit 5d7dca1

Please sign in to comment.