diff --git a/app/controllers/admin/invitations_controller.rb b/app/controllers/admin/invitations_controller.rb index c64fe963d..0b51fd085 100644 --- a/app/controllers/admin/invitations_controller.rb +++ b/app/controllers/admin/invitations_controller.rb @@ -24,7 +24,6 @@ module Admin username: username, remote_profile_image_url: ::Users::ProfileImageGenerator.call, saw_onboarding: false, - editor_version: :v2, registered: false) flash[:success] = "The invite has been sent to the user's email." redirect_to admin_invitations_path diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 24a7a1efb..2c47f2458 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -80,7 +80,6 @@ class RegistrationsController < Devise::RegistrationsController build_resource(sign_up_params) resource.saw_onboarding = false resource.registered_at = Time.current - resource.editor_version = "v2" resource.remote_profile_image_url = Users::ProfileImageGenerator.call if resource.remote_profile_image_url.blank? check_allowed_email(resource) if resource.email.present? resource.save if resource.email.present? diff --git a/app/services/authentication/authenticator.rb b/app/services/authentication/authenticator.rb index 3091368f8..33c94cff7 100644 --- a/app/services/authentication/authenticator.rb +++ b/app/services/authentication/authenticator.rb @@ -125,8 +125,7 @@ module Authentication signup_cta_variant: cta_variant, registered: true, registered_at: Time.current, - saw_onboarding: false, - editor_version: :v2 + saw_onboarding: false } end diff --git a/db/migrate/20210624153854_change_default_value_for_editor_version.rb b/db/migrate/20210624153854_change_default_value_for_editor_version.rb new file mode 100644 index 000000000..3d20c93f4 --- /dev/null +++ b/db/migrate/20210624153854_change_default_value_for_editor_version.rb @@ -0,0 +1,5 @@ +class ChangeDefaultValueForEditorVersion < ActiveRecord::Migration[6.1] + def change + change_column_default :users, :editor_version, from: "v1", to: "v2" + end +end diff --git a/db/schema.rb b/db/schema.rb index cc0eabb9a..107549d79 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: 2021_06_22_002941) do +ActiveRecord::Schema.define(version: 2021_06_24_153854) do # These are extensions that must be enabled in order to support this database enable_extension "citext" @@ -1309,7 +1309,7 @@ ActiveRecord::Schema.define(version: 2021_06_22_002941) do t.boolean "display_announcements", default: true t.boolean "display_sponsors", default: true t.string "dribbble_url" - t.string "editor_version", default: "v1" + t.string "editor_version", default: "v2" t.string "education" t.string "email" t.boolean "email_badge_notifications", default: true diff --git a/spec/services/article_with_video_creation_service_spec.rb b/spec/services/article_with_video_creation_service_spec.rb index f65a0b574..39ffce0ea 100644 --- a/spec/services/article_with_video_creation_service_spec.rb +++ b/spec/services/article_with_video_creation_service_spec.rb @@ -10,7 +10,7 @@ RSpec.describe ArticleWithVideoCreationService, type: :service do describe "#create!" do it "works" do Timecop.travel(3.weeks.ago) - user = create(:user) + user = create(:user, editor_version: "v1") Timecop.return test = build_stubbed(:article, user: user, video: link).attributes.symbolize_keys article = described_class.new(test, user).create! diff --git a/spec/services/articles/builder_spec.rb b/spec/services/articles/builder_spec.rb index 32fd7e5f5..f739cdb6f 100644 --- a/spec/services/articles/builder_spec.rb +++ b/spec/services/articles/builder_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Articles::Builder, type: :service do let(:prefill) { nil } context "when tag_user_editor_v2" do - let(:user) { create(:user, editor_version: "v2") } + let(:user) { create(:user) } let(:tag) { create(:tag) } let(:submission_template) { tag.submission_template_customized(user.name).to_s } let(:correct_attributes) do @@ -48,7 +48,7 @@ RSpec.describe Articles::Builder, type: :service do end context "when prefill_user_editor_v2" do - let(:user) { create(:user, editor_version: "v2") } + let(:user) { create(:user) } let(:prefill) { "dsdweewewew" } let(:correct_attributes) do { @@ -89,6 +89,7 @@ RSpec.describe Articles::Builder, type: :service do end context "when tag" do + let(:user) { create(:user, editor_version: "v1") } let(:tag) { create(:tag) } let(:correct_attributes) do { @@ -108,7 +109,7 @@ RSpec.describe Articles::Builder, type: :service do end context "when user_editor_v2" do - let(:user) { create(:user, editor_version: "v2") } + let(:user) { create(:user) } let(:correct_attributes) do { user_id: user.id @@ -125,6 +126,7 @@ RSpec.describe Articles::Builder, type: :service do end context "when user_editor_v1" do + let(:user) { create(:user, editor_version: "v1") } let(:correct_attributes) do body = "---\ntitle: \npublished: false\ndescription: \ntags: " \ "\n//cover_image: https://direct_url_to_image.jpg\n---\n\n" diff --git a/spec/support/seeds/seeds_e2e.rb b/spec/support/seeds/seeds_e2e.rb index baafc7bd0..a3e3f4698 100644 --- a/spec/support/seeds/seeds_e2e.rb +++ b/spec/support/seeds/seeds_e2e.rb @@ -134,7 +134,6 @@ seeder.create_if_doesnt_exist(User, "email", "article-editor-v2-user@forem.com") saw_onboarding: true, checked_code_of_conduct: true, checked_terms_and_conditions: true, - editor_version: "v2", ) end diff --git a/spec/system/articles/user_creates_an_article_spec.rb b/spec/system/articles/user_creates_an_article_spec.rb index 2d52f852c..4c9c1423b 100644 --- a/spec/system/articles/user_creates_an_article_spec.rb +++ b/spec/system/articles/user_creates_an_article_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe "Creating an article with the editor", type: :system do include_context "with runkit_tag" - let(:user) { create(:user) } + let(:user) { create(:user, editor_version: "v1") } let!(:template) { file_fixture("article_published.txt").read } let!(:template_with_runkit_tag) do file_fixture("article_with_runkit_tag.txt").read diff --git a/spec/system/articles/user_fixes_a_draft_spec.rb b/spec/system/articles/user_fixes_a_draft_spec.rb index 54bd8d1e5..979a8f836 100644 --- a/spec/system/articles/user_fixes_a_draft_spec.rb +++ b/spec/system/articles/user_fixes_a_draft_spec.rb @@ -11,7 +11,7 @@ RSpec.describe "", type: :system do it "let's the user fix a broken draft without publishing", js: true, aggregate_failures: true do # Create a new blog post and add content that validates correctly - sign_in create(:user, editor_version: "v2") + sign_in create(:user) visit new_path fill_in "article-form-title", with: "Regression spec" fill_in "article_body_markdown", with: correct_liquid_tag diff --git a/spec/system/user_uses_the_editor_spec.rb b/spec/system/user_uses_the_editor_spec.rb index 5202abccc..d6bbacf3a 100644 --- a/spec/system/user_uses_the_editor_spec.rb +++ b/spec/system/user_uses_the_editor_spec.rb @@ -57,7 +57,9 @@ RSpec.describe "Using the editor", type: :system do end end - describe "Submitting an article", js: true do + describe "Submitting an article with v1 editor", js: true do + before { user.update!(editor_version: "v1") } + it "fill out form and submit", cloudinary: true do fill_markdown_with(read_from_file(raw_text)) find("button", text: /\ASave changes\z/).click @@ -94,8 +96,6 @@ RSpec.describe "Using the editor", type: :system do end describe "using v2 editor", js: true do - before { user.update(editor_version: "v2") } - it "fill out form with rich content and click publish" do visit "/new" fill_in "article-form-title", with: "This is a test"