Skip to content

Commit 7f6880b

Browse files
Make method public
1 parent 7bcb0c6 commit 7f6880b

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

app/decorators/decidim/admin/selective_newsletter_form_decorator.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ def self.decorate
99
attribute :send_to_selected_users, ::Decidim::AttributeObject::Form::Boolean
1010
validates :send_to_selected_users, presence: true, if: :only_selected_users_selected?
1111

12+
def newsletters_with_selected_recipients_options
13+
Decidim::Newsletter
14+
.where(organization: current_organization)
15+
.where.not(sent_at: nil)
16+
.where("extended_data @> ?", Arel.sql({ send_to_selected_users: true }.to_json))
17+
.filter_map do |newsletter|
18+
[translated_attribute(newsletter.subject), newsletter.id] if newsletter.extended_data["selected_users_ids"]&.compact_blank.present?
19+
end
20+
end
21+
1222
private
1323

1424
def at_least_one_participatory_space_selected
@@ -64,16 +74,6 @@ def only_selected_users_selected?
6474
send_to_participants.blank? &&
6575
send_to_verified_users.blank?
6676
end
67-
68-
def newsletters_with_selected_recipients_options
69-
Decidim::Newsletter
70-
.where(organization: current_organization)
71-
.where.not(sent_at: nil)
72-
.where("extended_data @> ?", Arel.sql({ send_to_selected_users: true }.to_json))
73-
.filter_map do |newsletter|
74-
[translated_attribute(newsletter.subject), newsletter.id] if newsletter.extended_data["selected_users_ids"]&.compact_blank.present?
75-
end
76-
end
7777
end
7878
end
7979
end

0 commit comments

Comments
 (0)