From da087466abeeef4578ec9c8116602edba6b6825e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Javier=20Moreno=20Hern=C3=A1ndez?= Date: Wed, 25 Nov 2020 11:25:55 +0100 Subject: [PATCH] [DEMAD-101] Correcciones Correcciones --- app/helpers/application_helper.rb | 4 ++++ app/views/mailer/newsletter.html.erb | 2 +- .../20201125101402_add_grant_moderated_contents.rb | 10 ++++++++++ db/schema.rb | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20201125101402_add_grant_moderated_contents.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d7224765910..6558e6e7512 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -81,4 +81,8 @@ def management_controller? controller.class.to_s.include?("Management") end + def host_helper + root_url + end + end diff --git a/app/views/mailer/newsletter.html.erb b/app/views/mailer/newsletter.html.erb index c310f2596d0..a08893a0ca4 100644 --- a/app/views/mailer/newsletter.html.erb +++ b/app/views/mailer/newsletter.html.erb @@ -1,5 +1,5 @@

- <%= safe_html_with_links @newsletter.body.html_safe %> + <%= safe_html_with_links @newsletter.body.gsub(/\/system\/ckeditor_assets\/pictures/,"#{host_helper}system/ckeditor_assets/pictures").html_safe %>

diff --git a/db/migrate/20201125101402_add_grant_moderated_contents.rb b/db/migrate/20201125101402_add_grant_moderated_contents.rb new file mode 100644 index 00000000000..1fa2e8f5749 --- /dev/null +++ b/db/migrate/20201125101402_add_grant_moderated_contents.rb @@ -0,0 +1,10 @@ +class AddGrantModeratedContents < ActiveRecord::Migration[5.0] + def change + if !Rails.env.development? && !Rails.env.text? + execute "ALTER TABLE moderated_contents + OWNER TO participacion_owner; + GRANT ALL ON TABLE moderated_contents TO participacion_owner; + GRANT SELECT ON TABLE moderated_contents TO participacion_read;" + end + end +end diff --git a/db/schema.rb b/db/schema.rb index dc5d2ce9a3a..ba546c28056 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20201120071038) do +ActiveRecord::Schema.define(version: 20201125101402) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql"