From ac5934e63fea76d9978830ccdda1d3723cb22c35 Mon Sep 17 00:00:00 2001 From: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> Date: Thu, 9 Dec 2021 08:17:53 -0700 Subject: [PATCH] Conditionally Renders Links Within the COC During Creator Onboarding (#15692) * Conditionally renders links within the COC via a creator_settings_form? method * Updates the creator_settings_form? method within application_helper.rb * Replaces current_user with a custom creator var * Adds feature flag check to guard clause in application_helper.rb * Wake up, Travis --- app/helpers/application_helper.rb | 8 ++++++++ app/views/pages/_coc_text.html.erb | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4174af3a7..22f066c60 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -314,4 +314,12 @@ module ApplicationHelper link_to(label, tag_path(tag), options) end + + def creator_settings_form? + return unless FeatureFlag.enabled?(:creator_onboarding) + return unless User.with_role(:creator).any? + + creator = User.with_role(:creator).first + !creator.checked_code_of_conduct && !creator.checked_terms_and_conditions + end end diff --git a/app/views/pages/_coc_text.html.erb b/app/views/pages/_coc_text.html.erb index 3da83b471..0ddac03a6 100644 --- a/app/views/pages/_coc_text.html.erb +++ b/app/views/pages/_coc_text.html.erb @@ -1,7 +1,11 @@
All participants of <%= community_name %> are expected to abide by our Code of Conduct, both online and during in-person events that are hosted and/or associated with <%= community_name %>.
In the interest of fostering an open and welcoming environment, we as moderators of +<% if creator_settings_form? %> + <%= community_name %> pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. +<% else %> <%= community_name %> pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. +<% end %>
Examples of behavior that contributes to creating a positive environment include:
@@ -31,7 +35,11 @@Violations of the Code of Conduct may be reported by contacting the team via the +<% if creator_settings_form? %> + abuse report form or by sending an email to <%= email_link %>. All reports will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Further details of specific enforcement policies may be posted separately. +<% else %> ">abuse report form or by sending an email to <%= email_link %>. All reports will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Further details of specific enforcement policies may be posted separately. +<% end %>
Moderators have the right and responsibility to remove comments or other contributions that are not aligned to this Code of Conduct, or to suspend temporarily or permanently any members for other behaviors that they deem inappropriate, threatening, offensive, or harmful.