In the dev seeds, we were using `Setting["url"]/proposals`, but we can use `proposals_url` instead, similar to what we do in the rest of the application. We can do a similar thing in the sitemap. This way the sitemap will also work on installations who haven't manually set the "url" setting. Since we aren't using `Setting["url"]` anywhere anymore, we're removing it. This setting was mainly redundant, since we already had the `server_name` in the secrets. Furthermore, `server_name` is automatically configured when running the installer, while `Setting["url"]` had to be manually set in the admin section the application was installed. Note we're using `ActionMailer::Base` setting to generate URLs. Sounds a bit strange, but it's a standard way Rails provides to generate URLs outside the context of a request.
37 lines
1.2 KiB
Ruby
37 lines
1.2 KiB
Ruby
section "Creating Admin Notifications & Templates" do
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.proposal.#{attribute}") }
|
|
end
|
|
).merge(
|
|
link: Rails.application.routes.url_helpers.proposals_url(ActionMailer::Base.default_url_options),
|
|
segment_recipient: "administrators"
|
|
)
|
|
).deliver
|
|
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.help.#{attribute}") }
|
|
end
|
|
).merge(link: "https://crwd.in/consul", segment_recipient: "administrators")
|
|
).deliver
|
|
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.map.#{attribute}") }
|
|
end
|
|
).merge(segment_recipient: "administrators")
|
|
).deliver
|
|
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.budget.#{attribute}") }
|
|
end
|
|
).merge(segment_recipient: "administrators", sent_at: nil)
|
|
)
|
|
end
|