From 0e8a085ccef749ec982f69a3c791624fd9ca7d03 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2019 07:18:43 +0000 Subject: [PATCH 1/7] Bump scout_apm from 2.6.3 to 2.6.4 Bumps [scout_apm](https://github.com/scoutapp/scout_apm_ruby) from 2.6.3 to 2.6.4. - [Release notes](https://github.com/scoutapp/scout_apm_ruby/releases) - [Changelog](https://github.com/scoutapp/scout_apm_ruby/blob/master/CHANGELOG.markdown) - [Commits](https://github.com/scoutapp/scout_apm_ruby/compare/v2.6.3...v2.6.4) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index e85b300ce..28207b053 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -477,7 +477,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - scout_apm (2.6.3) + scout_apm (2.6.4) parser searchkick (4.1.0) activemodel (>= 5) From 46f6cd4fd9d2ebb164b9ff18946185f61f03762b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 17 Nov 2019 20:47:58 +0000 Subject: [PATCH 2/7] [Security] Bump nokogiri from 1.10.4 to 1.10.5 Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.4 to 1.10.5. **This update includes a security fix.** - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.4...v1.10.5) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 28207b053..47f763be6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -314,7 +314,7 @@ GEM multipart-post (2.1.1) newrelic_rpm (6.7.0.359) nio4r (2.5.2) - nokogiri (1.10.4) + nokogiri (1.10.5) mini_portile2 (~> 2.4.0) oauth (0.5.4) oauth2 (1.4.2) From 35c2073bd898069675d3ef06337287b342d2ebb4 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2019 19:29:11 +0000 Subject: [PATCH 3/7] [Security] Bump https-proxy-agent from 2.2.1 to 2.2.4 Bumps [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) from 2.2.1 to 2.2.4. **This update includes security fixes.** - [Release notes](https://github.com/TooTallNate/node-https-proxy-agent/releases) - [Commits](https://github.com/TooTallNate/node-https-proxy-agent/compare/2.2.1...2.2.4) Signed-off-by: dependabot-preview[bot] --- yarn.lock | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/yarn.lock b/yarn.lock index ee8b90606..232180d1d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -199,10 +199,10 @@ acorn@^5.5.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -agent-base@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9" - integrity sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg== +agent-base@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" + integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== dependencies: es6-promisify "^5.0.0" @@ -795,9 +795,9 @@ es6-promise-pool@^2.5.0: integrity sha1-FHxhKza0fxBQJ/nSv1SlmKmdnMs= es6-promise@^4.0.3: - version "4.2.6" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.6.tgz#b685edd8258886365ea62b57d30de28fadcd974f" - integrity sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q== + version "4.2.8" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" + integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== es6-promisify@^5.0.0: version "5.0.0" @@ -1215,11 +1215,11 @@ http-signature@~1.2.0: sshpk "^1.7.0" https-proxy-agent@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0" - integrity sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ== + version "2.2.4" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" + integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== dependencies: - agent-base "^4.1.0" + agent-base "^4.3.0" debug "^3.1.0" hyperlinker@^1.0.0: @@ -1541,9 +1541,9 @@ ms@2.0.0: integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= ms@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" - integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== mute-stream@0.0.7: version "0.0.7" From 0958a134ed04ebbaff4f1a33a280f37aad1fc594 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 19 Nov 2019 15:14:08 +1300 Subject: [PATCH 4/7] Finish the CMS upgrade and fix #2098 --- db/migrate/20191119020643_upgrade_cms.rb | 34 ++++++++++++++++ db/schema.rb | 52 ++++++++++++++---------- 2 files changed, 65 insertions(+), 21 deletions(-) create mode 100644 db/migrate/20191119020643_upgrade_cms.rb diff --git a/db/migrate/20191119020643_upgrade_cms.rb b/db/migrate/20191119020643_upgrade_cms.rb new file mode 100644 index 000000000..102ac79b3 --- /dev/null +++ b/db/migrate/20191119020643_upgrade_cms.rb @@ -0,0 +1,34 @@ +class UpgradeCms < ActiveRecord::Migration[5.2] + def change + rename_table :comfy_cms_blocks, :comfy_cms_fragments + rename_column :comfy_cms_fragments, :blockable_id, :record_id + rename_column :comfy_cms_fragments, :blockable_type, :record_type + add_column :comfy_cms_fragments, :tag, :string, null: false, default: 'text' + add_column :comfy_cms_fragments, :datetime, :datetime + add_column :comfy_cms_fragments, :boolean, :boolean, null: false, default: false + change_column :comfy_cms_files, :label, :string, null: false, default: '' + change_column :comfy_cms_files, :file_file_name, :string, null: true + remove_column :comfy_cms_files, :file_content_type + remove_column :comfy_cms_files, :file_file_size + remove_index :comfy_cms_sites, :is_mirrored + remove_column :comfy_cms_sites, :is_mirrored + remove_column :comfy_cms_layouts, :is_shared + remove_column :comfy_cms_pages, :is_shared + remove_column :comfy_cms_snippets, :is_shared + + limit = 16777215 + create_table :comfy_cms_translations, force: true do |t| + t.string :locale, null: false + t.integer :page_id, null: false + t.integer :layout_id + t.string :label, null: false + t.text :content_cache, limit: limit + t.boolean :is_published, null: false, default: true + t.timestamps + + t.index [:page_id] + t.index [:locale] + t.index [:is_published] + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 041da08a4..8c61de6cb 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: 2019_10_29_024101) do +ActiveRecord::Schema.define(version: 2019_11_19_020643) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -35,17 +35,6 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do t.index ["member_id"], name: "index_authentications_on_member_id" end - create_table "comfy_cms_blocks", id: :serial, force: :cascade do |t| - t.string "identifier", null: false - t.text "content" - t.string "blockable_type" - t.integer "blockable_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["blockable_id", "blockable_type"], name: "index_comfy_cms_blocks_on_blockable_id_and_blockable_type" - t.index ["identifier"], name: "index_comfy_cms_blocks_on_identifier" - end - create_table "comfy_cms_categories", id: :serial, force: :cascade do |t| t.integer "site_id", null: false t.string "label", null: false @@ -63,10 +52,8 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do create_table "comfy_cms_files", id: :serial, force: :cascade do |t| t.integer "site_id", null: false t.integer "block_id" - t.string "label", null: false - t.string "file_file_name", null: false - t.string "file_content_type", null: false - t.integer "file_file_size", null: false + t.string "label", default: "", null: false + t.string "file_file_name" t.string "description", limit: 2048 t.integer "position", default: 0, null: false t.datetime "created_at" @@ -77,6 +64,20 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do t.index ["site_id", "position"], name: "index_comfy_cms_files_on_site_id_and_position" end + create_table "comfy_cms_fragments", id: :serial, force: :cascade do |t| + t.string "identifier", null: false + t.text "content" + t.string "record_type" + t.integer "record_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "tag", default: "text", null: false + t.datetime "datetime" + t.boolean "boolean", default: false, null: false + t.index ["identifier"], name: "index_comfy_cms_fragments_on_identifier" + t.index ["record_id", "record_type"], name: "index_comfy_cms_fragments_on_record_id_and_record_type" + end + create_table "comfy_cms_layouts", id: :serial, force: :cascade do |t| t.integer "site_id", null: false t.integer "parent_id" @@ -87,7 +88,6 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do t.text "css" t.text "js" t.integer "position", default: 0, null: false - t.boolean "is_shared", default: false, null: false t.datetime "created_at" t.datetime "updated_at" t.index ["parent_id", "position"], name: "index_comfy_cms_layouts_on_parent_id_and_position" @@ -106,7 +106,6 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do t.integer "position", default: 0, null: false t.integer "children_count", default: 0, null: false t.boolean "is_published", default: true, null: false - t.boolean "is_shared", default: false, null: false t.datetime "created_at" t.datetime "updated_at" t.index ["parent_id", "position"], name: "index_comfy_cms_pages_on_parent_id_and_position" @@ -127,9 +126,7 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do t.string "hostname", null: false t.string "path" t.string "locale", default: "en", null: false - t.boolean "is_mirrored", default: false, null: false t.index ["hostname"], name: "index_comfy_cms_sites_on_hostname" - t.index ["is_mirrored"], name: "index_comfy_cms_sites_on_is_mirrored" end create_table "comfy_cms_snippets", id: :serial, force: :cascade do |t| @@ -138,13 +135,26 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do t.string "identifier", null: false t.text "content" t.integer "position", default: 0, null: false - t.boolean "is_shared", default: false, null: false t.datetime "created_at" t.datetime "updated_at" t.index ["site_id", "identifier"], name: "index_comfy_cms_snippets_on_site_id_and_identifier", unique: true t.index ["site_id", "position"], name: "index_comfy_cms_snippets_on_site_id_and_position" end + create_table "comfy_cms_translations", force: :cascade do |t| + t.string "locale", null: false + t.integer "page_id", null: false + t.integer "layout_id" + t.string "label", null: false + t.text "content_cache" + t.boolean "is_published", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["is_published"], name: "index_comfy_cms_translations_on_is_published" + t.index ["locale"], name: "index_comfy_cms_translations_on_locale" + t.index ["page_id"], name: "index_comfy_cms_translations_on_page_id" + end + create_table "comments", id: :serial, force: :cascade do |t| t.integer "post_id", null: false t.integer "author_id", null: false From 0ece05ca6bc62b46a739afefdf154faaf82359ab Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Tue, 19 Nov 2019 02:15:15 +0000 Subject: [PATCH 5/7] [CodeFactor] Apply fixes to commit 0958a13 --- db/migrate/20191119020643_upgrade_cms.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20191119020643_upgrade_cms.rb b/db/migrate/20191119020643_upgrade_cms.rb index 102ac79b3..8b2b34f5c 100644 --- a/db/migrate/20191119020643_upgrade_cms.rb +++ b/db/migrate/20191119020643_upgrade_cms.rb @@ -16,7 +16,7 @@ class UpgradeCms < ActiveRecord::Migration[5.2] remove_column :comfy_cms_pages, :is_shared remove_column :comfy_cms_snippets, :is_shared - limit = 16777215 + limit = 16_777_215 create_table :comfy_cms_translations, force: true do |t| t.string :locale, null: false t.integer :page_id, null: false From 327014ba73b5620bce429bbf3abc23dddceb3d26 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 19 Nov 2019 16:04:11 +1300 Subject: [PATCH 6/7] Migrate CMS tags copied from https://github.com/comfy/comfortable-mexican-sofa/wiki/HowTo:-Upgrade-CMS-From-1.12-to-2.0 --- db/migrate/20191119030244_cms_tags.rb | 75 +++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 db/migrate/20191119030244_cms_tags.rb diff --git a/db/migrate/20191119030244_cms_tags.rb b/db/migrate/20191119030244_cms_tags.rb new file mode 100644 index 000000000..4a936da9d --- /dev/null +++ b/db/migrate/20191119030244_cms_tags.rb @@ -0,0 +1,75 @@ +class CmsTags < ActiveRecord::Migration[5.2] + def change + Comfy::Cms::Layout.all.each do |layout| + layout.content = layout.content.gsub(%r{\{\{ ?cms:page:([\w/]+) ?\}\}}, '{{ cms:text \1 }}') if layout.content.is_a? String + + # {{cms:page:page_header:string}} -> {{ cms:text page_header }} + layout.content = layout.content.gsub(/\{\{ ?cms:page:([\w]+):string ?\}\}/, '{{ cms:text \1 }}') if layout.content.is_a? String + + # {{cms:page:content:rich_text}} -> {{ cms:wysiwyg content }} + layout.content = layout.content.gsub(/\{\{ ?cms:page:([\w]+):rich_text ?\}\}/, '{{ cms:wysiwyg \1 }}') if layout.content.is_a? String + layout.content = layout.content.gsub(/\{\{ ?cms:page:([\w]+):([^:]*) ?\}\}/, '{{ cms:\2 \1 }}') if layout.content.is_a? String + if layout.content.is_a? String + layout.content = layout.content.gsub(/\{\{ ?cms:field:([\w]+):string ?\}\}/, '{{ cms:text \1, render: false }}') + end + if layout.content.is_a? String + layout.content = layout.content.gsub(/\{\{ ?cms:field:([\w]+):([^:]*) ?\}\}/, '{{ cms:\2 \1, render: false }}') + end + + # {{ cms:partial:main/homepage }} -> {{ cms:partial "main/homepage" }} + if layout.content.is_a? String + layout.content = layout.content.gsub(%r{\{\{ ?cms:asset:([\w/-]+):([\w/-]+):([\w/-]+) ?\}\}}, '{{ cms:asset \1 type: \2 as: tag}}') + end + layout.content = layout.content.gsub(%r{\{\{ ?cms:partial:([\w/]+) ?\}\}}, '{{ cms:partial \1 }}') if layout.content.is_a? String + layout.content = layout.content.gsub(%r{\{\{ ?cms:(\w+):([\w/-]+) ?\}\}}, '{{ cms:\1 \2 }}') if layout.content.is_a? String + if layout.content.is_a? String + layout.content = layout.content.gsub(%r{\{\{ ?cms:(\w+):([\w/-]+):([\w/-]+):([\w/-]+) ?\}\}}, '{{ cms:\1 \2 \3 \4}}') + end + layout.content = layout.content.gsub(/\{\{ ?cms:(\w+):([\w]+):([^:]*) ?\}\}/, '{{ cms:\1 \2, "\3" }}') if layout.content.is_a? String + layout.content = layout.content.gsub(/cms:rich_text/, 'cms:wysiwyg') if layout.content.is_a? String + layout.content = layout.content.gsub(/cms:integer/, 'cms:number') if layout.content.is_a? String + layout.content = layout.content.gsub(/cms: string/, 'cms:text') if layout.content.is_a? String # probably a result of goofing one of the more general regexps + if layout.content.is_a? String + layout.content = layout.content.gsub(%r{\{\{ ?cms:page_file ([\w/]+) ?\}\}}, '{{ cms:file \1, render: false }}') + end + if layout.content.is_a? String + layout.content = layout.content.gsub(//, "{{ cms:text \1, render: false }}") + end + + layout.save if layout.changed? + end + Comfy::Cms::Fragment.all.each do |fragment| + # {{ cms:partial:main/homepage }} -> {{ cms:partial "main/homepage" }} + fragment.datetime = fragment.updated_at if fragment.datetime.nil? + if fragment.content.is_a? String + fragment.content = fragment.content.gsub(%r{\{\{ ?cms:partial:([\w/]+) ?\}\}}, '{{ cms:partial \1 }}') + end + + fragment.content = fragment.content.gsub(/\{\{ ?cms:page:([\w]+):string ?\}\}/, '{{ cms:text \1 }}') if fragment.content.is_a? String + if fragment.content.is_a? String + fragment.content = fragment.content.gsub(/\{\{ ?cms:page:([\w]+):rich_text ?\}\}/, '{{ cms:wysiwyg \1 }}') + end + + fragment.content = fragment.content.gsub(%r{\{\{ ?cms:page:([\w/]+) ?\}\}}, '{{ cms:text \1 }}') if fragment.content.is_a? String + fragment.content = fragment.content.gsub(/\{\{ ?cms:page:([\w]+):([^:]*) ?\}\}/, '{{ cms:\2 \1 }}') if fragment.content.is_a? String + if fragment.content.is_a? String + fragment.content = fragment.content.gsub(/\{\{ ?cms:field:([\w]+):([^:]*) ?\}\}/, '{{ cms:\2 \1, render: false }}') + end + + fragment.content = fragment.content.gsub(/\{\{ ?cms:(\w+):([\w]+) ?\}\}/, '{{ cms:\1 \2 }}') if fragment.content.is_a? String + if fragment.content.is_a? String + fragment.content = fragment.content.gsub(/\{\{ ?cms:(\w+):([\w]+):([^:]*) ?\}\}/, '{{ cms:\1 \2, "\3" }}') + end + fragment.save if fragment.changed? + end + + # With the change from Block to Fragment, Revision.data hash keys need to be updated + Comfy::Cms::Revision.all.each do |revision| + next if revision.data['blocks_attributes'].blank? + + revision.data['fragments_attributes'] = revision.data['blocks_attributes'] + revision.data.delete('blocks_attributes') + revision.save + end + end +end From 363d39705ab949e9bd56db340ade6bcf24503062 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 19 Nov 2019 16:09:01 +1300 Subject: [PATCH 7/7] migration goes up only --- db/migrate/20191119030244_cms_tags.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20191119030244_cms_tags.rb b/db/migrate/20191119030244_cms_tags.rb index 4a936da9d..fa3ef0d4c 100644 --- a/db/migrate/20191119030244_cms_tags.rb +++ b/db/migrate/20191119030244_cms_tags.rb @@ -1,5 +1,5 @@ class CmsTags < ActiveRecord::Migration[5.2] - def change + def up Comfy::Cms::Layout.all.each do |layout| layout.content = layout.content.gsub(%r{\{\{ ?cms:page:([\w/]+) ?\}\}}, '{{ cms:text \1 }}') if layout.content.is_a? String