Provide COC and TOS Checkboxes During Creator Onboarding (#15430)
* WIP: Add COC and TOS checkboxes to Creator Settings form * Adds assertions to the creatorSettings.spec.js E2E test * Removes comments and unnecessary code from Admin::CreatorSettingsController * Removes params from transaction * Updates creatorSettings.spec.js to fix checkbox-related failures * Adds a note to the COC and TOS checkboxes
This commit is contained in:
parent
e5cda63391
commit
363c099bab
3 changed files with 40 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
|||
module Admin
|
||||
class CreatorSettingsController < Admin::ApplicationController
|
||||
ALLOWED_PARAMS = %i[community_name logo_svg primary_brand_color_hex invite_only_mode public].freeze
|
||||
ALLOWED_PARAMS = %i[community_name logo_svg primary_brand_color_hex invite_only_mode public checked_code_of_conduct
|
||||
checked_terms_and_conditions].freeze
|
||||
|
||||
def new; end
|
||||
|
||||
|
|
@ -13,12 +14,11 @@ module Admin
|
|||
::Settings::Authentication.invite_only_mode = settings_params[:invite_only]
|
||||
::Settings::UserExperience.public = settings_params[:public]
|
||||
end
|
||||
# For this feature to work as expected for the time being, we must set the COC and TOS to true.
|
||||
# However, this is not a viable solution, as Forem Creators are required to see and check the
|
||||
# COC and TOS. Bypassing them in this manner will not do and we will need to rethink this solution.
|
||||
# TODO: Replace the current solution of setting the COC and TOS to true with a better, more
|
||||
# long-term solution for Forem Creators.
|
||||
current_user.update!(saw_onboarding: true, checked_code_of_conduct: true, checked_terms_and_conditions: true)
|
||||
current_user.update!(
|
||||
saw_onboarding: true,
|
||||
checked_code_of_conduct: settings_params[:checked_code_of_conduct],
|
||||
checked_terms_and_conditions: settings_params[:checked_terms_and_conditions],
|
||||
)
|
||||
redirect_to root_path
|
||||
rescue StandardError => e
|
||||
flash.now[:error] = e.message
|
||||
|
|
|
|||
|
|
@ -78,3 +78,22 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="crayons-field mt-6 align-left">
|
||||
<fieldset aria-describedby="section-description">
|
||||
<legend class="crayons-field__label mb-2">Finally, please agree to the following:</legend>
|
||||
<div>
|
||||
<div class="mb-2">
|
||||
<%= hidden_field_tag :checked_code_of_conduct, "0" %>
|
||||
<%= check_box_tag :checked_code_of_conduct, "1", false, class: "crayons-checkbox", required: true %>
|
||||
<label for="checked_code_of_conduct">I agree to uphold our <a href="/code-of-conduct">Code of Conduct</a>.</label>
|
||||
</div>
|
||||
<div>
|
||||
<%= hidden_field_tag :checked_terms_and_conditions, "0" %>
|
||||
<%= check_box_tag :checked_terms_and_conditions, "1", false, class: "crayons-checkbox", required: true %>
|
||||
<label for="checked_terms_and_conditions">I agree to our <a href="/terms-and-conditions">Terms and Conditions</a>.</label>
|
||||
</div>
|
||||
</div>
|
||||
<p class="crayons-field__description fs-italic p-2">You will have the opportunity to establish the Code of Conduct and Terms and Conditions for the users of your Forem during the setup process.</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -54,6 +54,20 @@ describe('Creator Settings Page', () => {
|
|||
cy.findAllByRole('radio', { name: /members only/i }).check();
|
||||
cy.findAllByRole('radio').should('be.checked');
|
||||
|
||||
// should contain a 'I agree to uphold our Code of Conduct' checkbox field and allow selection upon click
|
||||
cy.findByRole('group', {
|
||||
name: /^finally, please agree to the following:/i,
|
||||
}).should('be.visible');
|
||||
cy.findAllByRole('checkbox').first().check();
|
||||
cy.findAllByRole('checkbox').should('be.checked');
|
||||
|
||||
// should contain a 'I agree to our Terms and Conditions' checkbox field and allow selection upon click
|
||||
cy.findByRole('group', {
|
||||
name: /^finally, please agree to the following:/i,
|
||||
}).should('be.visible');
|
||||
cy.findAllByRole('checkbox').eq(1).check();
|
||||
cy.findAllByRole('checkbox').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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue