app/queries/decidim/admin/newsletter_recipients.rb in decidim-admin-0.18.1 vs app/queries/decidim/admin/newsletter_recipients.rb in decidim-admin-0.19.0
- old
+ new
@@ -39,10 +39,11 @@
def spaces
return if @form.participatory_space_types.blank?
@form.participatory_space_types.map do |type|
next if type.ids.blank?
+
object_class = "Decidim::#{type.manifest_name.classify}"
if type.ids.include?("all")
object_class.constantize.where(organization: @organization)
else
object_class.constantize.where(id: type.ids.reject(&:blank?))
@@ -53,10 +54,11 @@
# Return the ids of Users that are following
# the spaces selected in form
def user_id_of_followers
return if spaces.blank?
return unless @form.send_to_followers
+
Decidim::Follow.user_follower_ids_for_participatory_spaces(spaces)
end
# Return the ids of Users that have participate
# the spaces selected in form
@@ -72,9 +74,10 @@
klass = Object.const_get(object)
participant_ids << klass.newsletter_participant_ids(component)
end
end
next unless defined?(Decidim::Comments)
+
Decidim::Comments.newsletter_participant_entities.flatten.each do |object|
klass = Object.const_get(object)
participant_ids << klass.newsletter_participant_ids(space)
end
end