Skip to content
Snippets Groups Projects
Commit 34f19613 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

whitelisted

parent 3fa00b76
No related branches found
No related tags found
No related merge requests found
......@@ -7,16 +7,35 @@ class Communication::Block::Template::Agenda < Communication::Block::Template::B
has_component :time, :option, options: [:future_or_present, :future, :present, :archive]
def selected_events
@selected_events ||= block.about&.website
.events
.for_language(block.language)
.published
.send(time)
.limit(quantity)
@selected_events ||= events_with_time_scope
end
def allowed_for_about?
website.present?
end
protected
def events_with_time_scope
events = block.about&.website
.events
.for_language(block.language)
.published
.limit(quantity)
# Whitelist for security
# (not very elegant though)
case time
when 'future_or_present'
return events.future_or_present
when 'future'
return events.future
when 'present'
return events.present
when 'archive'
return events.archive
else
return events
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment