Remove Creator Onboarding Feature Flags from Codebase (#15982)
* Removes FeatureFlag.enabled?(:creator_onboarding) from codebase * Removes FeatureFlag.enabled?(:creator_onboarding) from specs * Further cleanup, removal, and spec fixes * Fixes the user_request_confirmation_spec.rb * Reverts change to confirmation email button * Revert revert after looking at designs again :( * Removes redundant logo_png field from config + fixes test * Rewords an expectation in user_uses_the_editor_spec.rb * Revert removal of logo_png from Config images * Removes CSS class from user_uses_the_editor_spec.rb * Removes test from user_uses_the_editor_sepc.rb * Removes unnecessary else from _logo.html.erb * Adds back removed system spec * Removes SVG-related code from _logo.html.erb * Removes AsyncInfoController#use_creator_onboarding * Fixes spec failues due to removed code * Removes svg-related code (that I thought I removed already :/ ) * Re-removes FeatureFlag and logo_svg from _images.html.erb * Remove newest instances of FeatureFlag(:creator_onboarding) * remove instances where we use the creator_onboarding field from the base_data * fix: redirect to the correct path in the reguistrations controller based on whether the user is a creator or not Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
This commit is contained in:
parent
534f20bdfc
commit
8d00e27b69
22 changed files with 53 additions and 160 deletions
|
|
@ -42,7 +42,6 @@ function fetchBaseData() {
|
|||
if (checkUserLoggedIn()) {
|
||||
document.body.dataset.user = json.user;
|
||||
document.body.dataset.creator = json.creator;
|
||||
document.body.dataset.creatorOnboarding = json.creator_onboarding;
|
||||
browserStoreCache('set', json.user);
|
||||
|
||||
setTimeout(() => {
|
||||
|
|
@ -54,7 +53,6 @@ function fetchBaseData() {
|
|||
// Ensure user data is not exposed if no one is logged in
|
||||
delete document.body.dataset.user;
|
||||
delete document.body.dataset.creator;
|
||||
delete document.body.dataset.creatorOnboarding;
|
||||
browserStoreCache('remove');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ class AsyncInfoController < ApplicationController
|
|||
param: request_forgery_protection_token,
|
||||
token: form_authenticity_token,
|
||||
user: user_data,
|
||||
creator: user_is_a_creator,
|
||||
creator_onboarding: use_creator_onboarding
|
||||
creator: user_is_a_creator
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
@ -67,10 +66,6 @@ class AsyncInfoController < ApplicationController
|
|||
@user.creator?
|
||||
end
|
||||
|
||||
def use_creator_onboarding
|
||||
FeatureFlag.enabled?(:creator_onboarding) && user_is_a_creator
|
||||
end
|
||||
|
||||
def user_cache_key
|
||||
"user-info-#{current_user&.id}__
|
||||
#{current_user&.last_sign_in_at}__
|
||||
|
|
|
|||
|
|
@ -11,11 +11,7 @@ class ConfirmationsController < Devise::ConfirmationsController
|
|||
set_flash_message!(:notice, :confirmed)
|
||||
if resource.creator?
|
||||
sign_in(resource)
|
||||
if FeatureFlag.enabled?(:creator_onboarding)
|
||||
redirect_to new_admin_creator_setting_path
|
||||
else
|
||||
redirect_to root_path
|
||||
end
|
||||
redirect_to new_admin_creator_setting_path
|
||||
else
|
||||
respond_with_navigational(resource) { redirect_to after_confirmation_path_for(resource_name, resource) }
|
||||
end
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class RegistrationsController < Devise::RegistrationsController
|
|||
redirect_to confirm_email_path(email: resource.email)
|
||||
else
|
||||
sign_in(resource)
|
||||
if FeatureFlag.enabled?(:creator_onboarding)
|
||||
if resource.roles.includes(:creator).any?
|
||||
redirect_to new_admin_creator_setting_path
|
||||
else
|
||||
redirect_to root_path
|
||||
|
|
@ -78,7 +78,7 @@ class RegistrationsController < Devise::RegistrationsController
|
|||
resource.registered_at = Time.current
|
||||
resource.build_setting(editor_version: "v2")
|
||||
resource.remote_profile_image_url = Users::ProfileImageGenerator.call if resource.profile_image.blank?
|
||||
if FeatureFlag.enabled?(:creator_onboarding)
|
||||
if Settings::General.waiting_on_first_user
|
||||
resource.password_confirmation = resource.password
|
||||
end
|
||||
check_allowed_email(resource) if resource.email.present?
|
||||
|
|
|
|||
|
|
@ -301,7 +301,6 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def creator_settings_form?
|
||||
return unless FeatureFlag.enabled?(:creator_onboarding)
|
||||
return unless User.with_role(:creator).any?
|
||||
|
||||
creator = User.with_role(:creator).first
|
||||
|
|
|
|||
|
|
@ -37,10 +37,6 @@ module AuthenticationHelper
|
|||
Authentication::Providers.available.map(&:to_s)
|
||||
end
|
||||
|
||||
def forem_creator_flow_enabled?
|
||||
FeatureFlag.enabled?(:creator_onboarding) && waiting_on_first_user?
|
||||
end
|
||||
|
||||
def waiting_on_first_user?
|
||||
Settings::General.waiting_on_first_user
|
||||
end
|
||||
|
|
|
|||
|
|
@ -34,9 +34,7 @@ function onboardingSkippable(currentUser) {
|
|||
|
||||
function onboardCreator(currentUser) {
|
||||
return (
|
||||
document.body.dataset.creator === 'true' &&
|
||||
document.body.dataset.creatorOnboarding === 'true' &&
|
||||
!currentUser.saw_onboarding
|
||||
document.body.dataset.creator === 'true' && !currentUser.saw_onboarding
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<% if FeatureFlag.enabled?(:creator_onboarding) && User.with_role(:creator).any? %>
|
||||
<% if User.with_role(:creator).any? %>
|
||||
<style>
|
||||
<%= Rails.application.assets["setup-mode.css"].to_s.html_safe %>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -11,25 +11,7 @@
|
|||
} %>
|
||||
<div id="imagesBodyContainer" class="card-body collapse hide" aria-labelledby="imagesBodyContainer">
|
||||
<fieldset class="grid gap-4">
|
||||
|
||||
<% if FeatureFlag.enabled?(:creator_onboarding) %>
|
||||
<%= render partial: "admin/shared/logo_upload", locals: { f: f, allowed_types: logo_allowed_types, max_file_size: logo_max_file_size, logo: Settings::General.resized_logo } %>
|
||||
<% else %>
|
||||
<div class="crayons-field">
|
||||
<%= admin_config_label :logo_svg, "SVG logo (soon to be deprecated)" %>
|
||||
<%= admin_config_description Constants::Settings::General::DETAILS[:logo_svg][:description] %>
|
||||
<%= f.text_area :logo_svg,
|
||||
class: "crayons-textfield",
|
||||
value: Settings::General.logo_svg,
|
||||
rows: 6,
|
||||
placeholder: Constants::Settings::General::DETAILS[:logo_svg][:placeholder] %>
|
||||
<% if Settings::General.logo_svg.present? %>
|
||||
<div class="site-logo">
|
||||
<%= Settings::General.logo_svg.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render partial: "admin/shared/logo_upload", locals: { f: f, allowed_types: logo_allowed_types, max_file_size: logo_max_file_size, logo: Settings::General.resized_logo } %>
|
||||
|
||||
<div class="crayons-field">
|
||||
<%= admin_config_label :logo_png, "Secondary Logo" %>
|
||||
|
|
|
|||
|
|
@ -3,11 +3,7 @@
|
|||
Logo
|
||||
<% end %>
|
||||
|
||||
<% if FeatureFlag.enabled?(:creator_onboarding) %>
|
||||
<p id="logo-subtitle" class="crayons-field__description">Your logo will display in the upper left hand corner of your Forem. Upload a PNG or JPEG with a maximum size of 4096x4096px.</p>
|
||||
<% else %>
|
||||
<p id="logo-subtitle" class="crayons-field__description">You can adjust what your logo will look like here but it will not be live on the visitor facing site until after the release on 17 January. Upload a PNG or JPEG with a maximum size of 4096x4096px.</p>
|
||||
<% end %>
|
||||
<p id="logo-subtitle" class="crayons-field__description">Your logo will display in the upper left hand corner of your Forem. Upload a PNG or JPEG with a maximum size of 4096x4096px.</p>
|
||||
|
||||
<div class="flex flex-1 gap-4">
|
||||
<%= f.file_field :logo, accept: allowed_types.to_s, aria_describedby: "logo-subtitle", data: { "max-file-size-mb": max_file_size.to_s, action: "change->logo-upload#previewLogo" } %>
|
||||
|
|
|
|||
|
|
@ -1,68 +1,41 @@
|
|||
<% title "Confirm your email" %>
|
||||
<% proper_email = params[:email] || (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
||||
<main id="main-content" class="flex flex-1 justify-center flex-col crayons-layout">
|
||||
<% if FeatureFlag.enabled?(:creator_onboarding) %>
|
||||
<style>
|
||||
<%= Rails.application.assets["setup-mode.css"].to_s.html_safe %>
|
||||
</style>
|
||||
<%= javascript_packs_with_chunks_tag "confirmationEmail", defer: true %>
|
||||
<style>
|
||||
<%= Rails.application.assets["setup-mode.css"].to_s.html_safe %>
|
||||
</style>
|
||||
<%= javascript_packs_with_chunks_tag "confirmationEmail", defer: true %>
|
||||
|
||||
<div class="flex flex-1 flex-col items-center justify-center relative z-elevate align-center">
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
<%= inline_svg_tag("mail.svg", aria: true, title: "Email", class: "mb-6") %>
|
||||
<h1 class="fs-2xl m:fs-3xl lh-tight fw-bold mb-4">Great! Now confirm your email address.</h1>
|
||||
<% if proper_email.present? %>
|
||||
<p class="fs-l m:fs-xl color-base-70 m:max-w-50">
|
||||
We've sent an email to <span class="fw-bold"><%= proper_email %></span>.
|
||||
Click the button inside to confirm your email.</p>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="bg-base-10 p-4 mx-auto my-4 radius-default z-elevate">
|
||||
<button class="color-accent-brand text-underline cursor-pointer js-confirmation-button border-none p-0" role="button">Click here</button> if you didn't get the email...
|
||||
</div>
|
||||
<div class="flex flex-1 flex-col items-center justify-center relative z-elevate align-center">
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
<%= inline_svg_tag("mail.svg", aria: true, title: "Email", class: "mb-6") %>
|
||||
<h1 class="fs-2xl m:fs-3xl lh-tight fw-bold mb-4">Great! Now confirm your email address.</h1>
|
||||
<% if proper_email.present? %>
|
||||
<p class="fs-l m:fs-xl color-base-70 m:max-w-50">
|
||||
We've sent an email to <span class="fw-bold"><%= proper_email %></span>.
|
||||
Click the button inside to confirm your email.</p>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="bg-base-10 p-4 mx-auto my-4 radius-default z-elevate">
|
||||
<button class="color-accent-brand text-underline cursor-pointer js-confirmation-button border-none p-0" role="button">Click here</button> if you didn't get the email...
|
||||
</div>
|
||||
|
||||
<%= inline_svg_tag("forem-background.svg", aria: true, title: "forem background", class: "forem-background absolute bottom-0 right-0 hidden m:block") %>
|
||||
<%= inline_svg_tag("forem-background.svg", aria: true, title: "forem background", class: "forem-background absolute bottom-0 right-0 hidden m:block") %>
|
||||
|
||||
<div id="confirm-email-modal" class="hidden">
|
||||
<div>Re-enter the email address below to resend the confirmation link</div>
|
||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }, data: { testid: "resend-confirmation-form" }) do |f| %>
|
||||
<div class="crayons-field mt-5 mb-3">
|
||||
<%= f.email_field :email, placeholder: "user@example.com", autocomplete: "email", aria: { label: "Confirmation email address" }, class: "crayons-textfield", required: true, value: proper_email %>
|
||||
</div>
|
||||
|
||||
<div class="flex">
|
||||
<%= f.submit "Resend", role: "button", class: "crayons-btn mr-1" %>
|
||||
<button class="crayons-btn color-base-70 crayons-btn--ghost js-dismiss-button" role="button">
|
||||
Dismiss
|
||||
</button>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="crayons-layout crayons-layout--limited-l align-center mt-9 mb-10 p-3">
|
||||
|
||||
<% if came_from_sign_up? %>
|
||||
<h1 class="fs-5xl mb-5">Welcome to <%= community_name %>! 🎉</h1>
|
||||
<% end %>
|
||||
<% if proper_email.present? %>
|
||||
<h3 class="mb-5">A confirmation email has been sent to <a href="mailto:<%= proper_email %>"><%= proper_email %></a></h3>
|
||||
<% end %>
|
||||
|
||||
<div class="mt-8 mb-6 crayons-card p-7 align-left mx-auto">
|
||||
<h2 class="pb-4">Didn't get the email?</h2>
|
||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }, data: { testid: "resend-confirmation-form" }) do |f| %>
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="crayons-field mt-2">
|
||||
<%= f.email_field :email, class: "crayons-textfield", aria: { label: "Confirmation email address" }, autofocus: false, value: proper_email %>
|
||||
</div>
|
||||
|
||||
<div class="crayons-field mt-2">
|
||||
<%= f.submit "Resend confirmation instructions", class: "crayons-btn" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id="confirm-email-modal" class="hidden">
|
||||
<div>Re-enter the email address below to resend the confirmation link</div>
|
||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }, data: { testid: "resend-confirmation-form" }) do |f| %>
|
||||
<div class="crayons-field mt-5 mb-3">
|
||||
<%= f.email_field :email, placeholder: "user@example.com", autocomplete: "email", aria: { label: "Confirmation email address" }, class: "crayons-textfield", required: true, value: proper_email %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="flex">
|
||||
<%= f.submit "Resend", role: "button", class: "crayons-btn mr-1" %>
|
||||
<button class="crayons-btn color-base-70 crayons-btn--ghost js-dismiss-button" role="button">
|
||||
Dismiss
|
||||
</button>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</main>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<% if forem_creator_flow_enabled? && waiting_on_first_user? %>
|
||||
<% if waiting_on_first_user? %>
|
||||
<%= render "shared/authentication/forem_creator_signup" %>
|
||||
<% else %>
|
||||
<%= render "shared/authentication/email_registration_form" %>
|
||||
|
|
|
|||
|
|
@ -6,14 +6,11 @@
|
|||
<div class="crayons-notice crayons-notice--danger mb-10 mt-8 mx-auto" style="width: 680px;max-width:94%;" role="alert">
|
||||
Email authentication is not enabled for this Forem.
|
||||
</div>
|
||||
<% elsif forem_creator_flow_enabled? %>
|
||||
<% elsif waiting_on_first_user? %>
|
||||
<style>
|
||||
<%= Rails.application.assets["setup-mode.css"].to_s.html_safe %>
|
||||
</style>
|
||||
<%= render "shared/authentication/forem_creator_signup" %>
|
||||
<% elsif waiting_on_first_user? %>
|
||||
<%# TODO: [@ridhwana]: Delete this view once forem creator onboarding is shipped %>
|
||||
<%= render "shared/authentication/initial_account_wizard" %>
|
||||
<% else %>
|
||||
<%= render "devise/shared/authorization_error" %>
|
||||
<%= render "devise/registrations/registration_form" %>
|
||||
|
|
|
|||
|
|
@ -1,21 +1,9 @@
|
|||
<a href="<%= root_path %>" class="site-logo" aria-label="<%= t("views.main.aria_home", community: community_name) %>">
|
||||
<!-- its a little explicit for the moment but it will make
|
||||
it easier to remove code along with the FeatureFlag -->
|
||||
<% if FeatureFlag.enabled?(:creator_onboarding) %>
|
||||
<% if Settings::General.resized_logo.present? %>
|
||||
<img class="site-logo__img" src="<%= Settings::General.resized_logo %>" alt="<%= community_name %>">
|
||||
<% else %>
|
||||
<span class="site-logo__community-name truncate-at-2">
|
||||
<%= community_name %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% if Settings::General.resized_logo.present? %>
|
||||
<img class="site-logo__img" src="<%= Settings::General.resized_logo %>" alt="<%= community_name %>">
|
||||
<% else %>
|
||||
<% if Settings::General.logo_svg.present? %>
|
||||
<%= logo_svg %>
|
||||
<% else %>
|
||||
<span class="site-logo__community-name truncate-at-2">
|
||||
<%= community_name %>
|
||||
</span>
|
||||
<% end %>
|
||||
<span class="site-logo__community-name truncate-at-2">
|
||||
<%= community_name %>
|
||||
</span>
|
||||
<% end %>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -44,9 +44,7 @@
|
|||
<% end %>
|
||||
</head>
|
||||
<% unless internal_navigation? %>
|
||||
<!-- adding the Feature Flag status to the top bar is temporary to show the logo from the correct place,
|
||||
it will be removed by latest 24/10/2021 -->
|
||||
<% cache(release_adjusted_cache_key("top-html-and-config--#{user_signed_in?}--#{FeatureFlag.enabled?(:creator_onboarding)}")) do %>
|
||||
<% cache(release_adjusted_cache_key("top-html-and-config--#{user_signed_in?}")) do %>
|
||||
<body
|
||||
data-user-status="<%= user_logged_in_status %>"
|
||||
data-community-name="<%= community_name %>"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ RSpec.describe "/creator_settings/new", type: :request do
|
|||
end
|
||||
|
||||
before do
|
||||
allow(FeatureFlag).to receive(:enabled?).with(:creator_onboarding).and_return(true)
|
||||
allow(Settings::General).to receive(:waiting_on_first_user).and_return(false)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ RSpec.describe "AsyncInfo", type: :request do
|
|||
sign_in create(:user)
|
||||
|
||||
get "/async_info/base_data"
|
||||
expect(response.parsed_body.keys).to match_array(%w[broadcast creator creator_onboarding param token user])
|
||||
expect(response.parsed_body.keys).to match_array(%w[broadcast creator param token user])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -147,9 +147,8 @@ RSpec.describe "Registrations", type: :request do
|
|||
end
|
||||
end
|
||||
|
||||
context "with the creator_onboarding feature flag" do
|
||||
context "when going through the Creator Onboarding flow" do
|
||||
before do
|
||||
allow(FeatureFlag).to receive(:enabled?).with(:creator_onboarding).and_return(true)
|
||||
allow(Settings::General).to receive(:waiting_on_first_user).and_return(true)
|
||||
allow(Settings::UserExperience).to receive(:public).and_return(false)
|
||||
end
|
||||
|
|
@ -437,11 +436,9 @@ RSpec.describe "Registrations", type: :request do
|
|||
end
|
||||
end
|
||||
|
||||
context "with the creator_onboarding feature flag" do
|
||||
context "when going through the Creator Onboarding flow" do
|
||||
before do
|
||||
allow_any_instance_of(ProfileImageUploader).to receive(:download!)
|
||||
allow(FeatureFlag).to receive(:enabled?).with(:creator_onboarding).and_return(true)
|
||||
allow(FeatureFlag).to receive(:enabled?).with(:runtime_banner).and_return(false)
|
||||
allow(Settings::General).to receive(:waiting_on_first_user).and_return(true)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1 @@
|
|||
return unless Rails.env.test? && ENV["E2E"].present?
|
||||
|
||||
FeatureFlag.enable(:creator_onboarding)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ RSpec.describe "Conditional registration (ForemWebView)", type: :system do
|
|||
end
|
||||
|
||||
before do
|
||||
allow(FeatureFlag).to receive(:enabled?).with(:creator_onboarding).and_return(false)
|
||||
allow(Settings::Authentication).to receive(:allow_email_password_registration).and_return(true)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ RSpec.describe "/confirm-email", type: :system do
|
|||
it "stays on the same page and displays a flash message", :aggregate_failures do
|
||||
visit confirm_email_path
|
||||
fill_in "user_email", with: "test@example.com"
|
||||
click_button "Resend confirmation instructions"
|
||||
click_button "Resend"
|
||||
|
||||
expect(page).to have_current_path(user_confirmation_path)
|
||||
expected_message = format(ConfirmationsController::FLASH_MESSAGE,
|
||||
|
|
|
|||
|
|
@ -2,28 +2,12 @@ require "rails_helper"
|
|||
|
||||
RSpec.describe "Logo behaviour with creator_onboarding Feature Flag", type: :system do
|
||||
let!(:user) { create(:user) }
|
||||
let(:logo_svg) { "<svg>Some svg</svg>" }
|
||||
let(:resized_logo) { "default.png" }
|
||||
|
||||
before do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context "when Feature flag creator_onboarding is disabled" do
|
||||
before do
|
||||
allow(Settings::General).to receive(:logo_svg).and_return(logo_svg)
|
||||
allow(FeatureFlag).to receive(:enabled?).with(:creator_onboarding).and_return(false)
|
||||
end
|
||||
|
||||
it "renders the logo_svg" do
|
||||
visit root_path
|
||||
expect(page).to have_css(".site-logo")
|
||||
within(".site-logo") do
|
||||
expect(page.html).to have_text("Some svg")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when Feature flag creator_onboarding is enabled" do
|
||||
before do
|
||||
allow(FeatureFlag).to receive(:enabled?).with(:creator_onboarding).and_return(true)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue