Skip to content

Commit 5d7dca1

Browse files
committed
Fix #28
1 parent a213b5e commit 5d7dca1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/decidim/term_customizer/context/controller_context.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ def resolve!
1313
# E.g. at the participatory process controller the
1414
# `decidim.current_participatory_space` environment variable has not
1515
# been set. Therefore, we need to fetch it directly from the
16-
# controller using its private method.
17-
@space =
18-
if controller.respond_to?(:current_participatory_space, true)
19-
controller.send(:current_participatory_space)
20-
else
21-
env["decidim.current_participatory_space"]
22-
end
16+
# controller using its private method. In some edge cases this may not
17+
# be implemented (https://github.com/mainio/decidim-module-term_customizer/issues/28)
18+
# in which case we do not have access to the participatory space.
19+
if controller.respond_to?(:current_participatory_space, true)
20+
@space = controller.try(
21+
:current_participatory_space
22+
)
23+
end
24+
@space ||= env["decidim.current_participatory_space"]
2325

2426
@component = env["decidim.current_component"]
2527
end

0 commit comments

Comments
 (0)