Destructive Actions
diff --git a/app/views/podcast_episodes/_episodes_feed.html.erb b/app/views/podcast_episodes/_episodes_feed.html.erb
index 011589004..7e5a1c98a 100644
--- a/app/views/podcast_episodes/_episodes_feed.html.erb
+++ b/app/views/podcast_episodes/_episodes_feed.html.erb
@@ -4,7 +4,7 @@
<%= optimized_image_tag(episode.image_url || episode.podcast.image_url,
optimizer_options: { crop: "imagga_scale", width: 240, height: 240 },
- image_options: { alt: episode.title, loading: "lazy"}) %>
+ image_options: { alt: episode.title, loading: "lazy" }) %>
<%= t("views.podcasts.tag") %><%= episode.title %>
diff --git a/config/locales/views/misc/en.yml b/config/locales/views/misc/en.yml
index eeb992a55..c466a5ede 100644
--- a/config/locales/views/misc/en.yml
+++ b/config/locales/views/misc/en.yml
@@ -86,4 +86,4 @@ en:
description: All videos on %{community}
heading: "%{community} on Video"
beta_html: "Video is beta: %{contact}"
- upload: "🎥 Upload Video File 🙌"
+ upload: "🎥 Upload Video File 🙌"
\ No newline at end of file
diff --git a/config/locales/views/misc/fr.yml b/config/locales/views/misc/fr.yml
index 7d4c802a6..c3f4fe08e 100644
--- a/config/locales/views/misc/fr.yml
+++ b/config/locales/views/misc/fr.yml
@@ -86,4 +86,4 @@ fr:
description: All videos on %{community}
heading: "%{community} en Vidéo"
beta_html: "Vidéo est en bêta: %{contact}"
- upload: "🎥 Télécharger un fichier vidéo 🙌"
+ upload: "🎥 Télécharger un fichier vidéo 🙌"
\ No newline at end of file
diff --git a/config/routes/admin.rb b/config/routes/admin.rb
index 6ec0b1a9e..d3a67ab6b 100644
--- a/config/routes/admin.rb
+++ b/config/routes/admin.rb
@@ -13,7 +13,9 @@ namespace :admin do
resources :invitations, only: %i[index new create destroy]
resources :organization_memberships, only: %i[update destroy create]
resources :permissions, only: %i[index]
- resources :reactions, only: [:update]
+ resources :reactions, only: %i[update]
+ resources :creator_settings, only: %i[create new]
+
namespace :settings do
resources :authentications, only: [:create]
resources :campaigns, only: [:create]
diff --git a/cypress/integration/creatorOnboardingFlows/creatorSettings.spec.js b/cypress/integration/creatorOnboardingFlows/creatorSettings.spec.js
new file mode 100644
index 000000000..164ae4388
--- /dev/null
+++ b/cypress/integration/creatorOnboardingFlows/creatorSettings.spec.js
@@ -0,0 +1,71 @@
+describe('Creator Setup Page', () => {
+ const { baseUrl } = Cypress.config();
+
+ beforeEach(() => {
+ cy.testSetup();
+ cy.fixture('users/creatorUser.json').as('creator');
+ cy.get('@creator').then((creator) => {
+ cy.loginCreator(creator);
+ });
+
+ cy.visit(`${baseUrl}admin/creator_settings/new?referrer=${baseUrl}`);
+ });
+
+ it('should submit the creator settings form', () => {
+ // should display a welcome message
+ cy.findByText("Lovely! Let's set up your Forem.").should('be.visible');
+ cy.findByText('No stress, you can always change it later.').should(
+ 'be.visible',
+ );
+
+ // should contain a community name and update the field properly
+ cy.findByRole('textbox', { name: /community name/i })
+ .as('communityName')
+ .invoke('attr', 'placeholder')
+ .should('eq', 'Climbing Life');
+ cy.get('@communityName').type('Climbing Life');
+
+ // should contain a logo upload field and upload a logo upon click
+ cy.findByText(/^Logo/).should('be.visible');
+ cy.findByRole('button', { name: /logo/i }).attachFile(
+ '/images/admin-image.png',
+ );
+
+ // should contain a brand color field
+ cy.findByText(/^Brand color/).should('be.visible');
+ cy.findByText(/^Brand color/).invoke('attr', 'value', '#ff0000');
+
+ // should contain a 'Who can join this community?' radio selector field and allow selection upon click
+ cy.findByRole('group', { name: /^Who can join this community/i }).should(
+ 'be.visible',
+ );
+ cy.findAllByRole('radio', { name: /everyone/i }).check();
+ cy.findAllByRole('radio').should('be.checked');
+
+ // should contain a 'Who can view content in this community?' radio selector field and allow selection upon click
+ cy.findByRole('group', {
+ name: /^Who can view content in this community/i,
+ }).should('be.visible');
+ cy.findAllByRole('radio', { name: /members only/i }).check();
+ cy.findAllByRole('radio').should('be.checked');
+
+ // should redirect the creator to the home page when the form is completely filled out and 'Finish' is clicked
+ cy.findByRole('button', { name: 'Finish' }).click();
+ cy.url().should('equal', baseUrl);
+ });
+
+ it('should not submit the creator settings form if any of the fields are not filled out', () => {
+ // TODO: Circle back around to testing this once the styling for the form is complete
+ cy.findByRole('textbox', { name: /community name/i }).should(
+ 'have.attr',
+ 'required',
+ );
+ cy.findByRole('button', { name: /logo/i }).should('have.attr', 'required');
+ // should not redirect the creator to the home page when the form is not completely filled out and 'Finish' is clicked
+ cy.findByRole('button', { name: 'Finish' }).click();
+ cy.url().should(
+ 'equal',
+ `${baseUrl}admin/creator_settings/new?referrer=${baseUrl}`,
+ );
+ });
+});
diff --git a/cypress/integration/creatorOnboardingFlows/creatorSignup.spec.js b/cypress/integration/creatorOnboardingFlows/creatorSignup.spec.js
index 14609bc79..f45e58288 100644
--- a/cypress/integration/creatorOnboardingFlows/creatorSignup.spec.js
+++ b/cypress/integration/creatorOnboardingFlows/creatorSignup.spec.js
@@ -96,6 +96,9 @@ describe('Creator Signup Page', () => {
.click();
const { baseUrl } = Cypress.config();
- cy.url().should('equal', `${baseUrl}onboarding?referrer=${baseUrl}`);
+ cy.url().should(
+ 'equal',
+ `${baseUrl}admin/creator_settings/new?referrer=${baseUrl}`,
+ );
});
});
diff --git a/cypress/support/commands.js b/cypress/support/commands.js
index f867ff828..f55a26cf8 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.js
@@ -138,7 +138,7 @@ Cypress.Commands.add('loginCreator', ({ name, username, email, password }) => {
return cy.request(
'POST',
'/users',
- `utf8=%E2%9C%93&user%5Bname%5D=${encodedName}&user%5Busername%5D=${encodedUsername}&user%5Bemail%5D=${encodedEmail}%40forem.local&user%5Bpassword%5D=${encodedPassword}&commit=Create+my+account`,
+ `utf8=%E2%9C%93&user%5Bname%5D=${encodedName}&user%5Busername%5D=${encodedUsername}&user%5Bemail%5D=${encodedEmail}%40forem.local&user%5Bpassword%5D=${encodedPassword}&commit=Create+my+account&user%5Bforem_owner_secret%5D=secret`,
);
}
diff --git a/spec/requests/admin/creator_settings_spec.rb b/spec/requests/admin/creator_settings_spec.rb
new file mode 100644
index 000000000..4e8dd3f06
--- /dev/null
+++ b/spec/requests/admin/creator_settings_spec.rb
@@ -0,0 +1,62 @@
+require "rails_helper"
+
+RSpec.describe "/creator_settings/new", type: :request do
+ let!(:creator) { create(:user, :creator) }
+ let!(:non_admin_user) { create(:user) }
+ let(:params) do
+ { community_name: "Climbing Life",
+ logo_svg: "https://dummyimage.com/300x300.png",
+ primary_brand_color_hex: "000000",
+ public: true,
+ invite_only: false }
+ 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
+
+ describe "GET /admin/creator_settings/new" do
+ before do
+ sign_in creator
+ get new_admin_creator_setting_path
+ end
+
+ context "when the user is a creator" do
+ it "allows the request" do
+ expect(response).to have_http_status(:ok)
+ end
+
+ it "renders the correct page" do
+ expect(response.body).to include("Lovely! Let's set up your Forem.")
+ end
+ end
+
+ context "when the user is a not a creator" do
+ before do
+ sign_in non_admin_user
+ end
+
+ it "blocks the request" do
+ expect do
+ get new_admin_creator_setting_path
+ end.to raise_error(Pundit::NotAuthorizedError)
+ end
+ end
+
+ describe "POST /admin/creator_settings/new" do
+ before do
+ sign_in creator
+ get new_admin_creator_setting_path
+ end
+
+ it "allows a creator to successfully fill out the creator setup form", :aggregate_failures do
+ post admin_creator_settings_path, params: params
+ expect(creator.saw_onboarding).to eq(true)
+ expect(creator.checked_code_of_conduct).to eq(true)
+ expect(creator.checked_terms_and_conditions).to eq(true)
+ expect(response).to have_http_status(:ok)
+ end
+ end
+ end
+end
diff --git a/spec/requests/async_info_spec.rb b/spec/requests/async_info_spec.rb
index 63e593f8e..126b38b9d 100644
--- a/spec/requests/async_info_spec.rb
+++ b/spec/requests/async_info_spec.rb
@@ -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 param token user])
+ expect(response.parsed_body.keys).to match_array(%w[broadcast creator creator_onboarding param token user])
end
end
end