From ca6ba1af7d7fa7f583262381d586e032f4aac211 Mon Sep 17 00:00:00 2001 From: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> Date: Mon, 28 Dec 2020 09:34:17 -0700 Subject: [PATCH] Replace collective_noun with community_name (#11846) [deploy] * Removes collective_noun and collective_noun_disabled from app * Config Generalization: replaces community_qualified_name with community_name - Generalizes SiteConfig after the removal of collective_noun field - Updates copy where necessary to be readable with community_name - Makes the community_name SiteConfig description more explicit - Adds flexibility for Admins by removing appended "community" * Adds a data_update script to remove collective_noun and collective_noun_disabled * Removes appended community from stories_controller.rb * Removes unnecessary quotation marks around SiteConfig.community_name.to_s * Makes SiteConfig community_name description more explicit * Removes topic from #email_from and replaces arg with _ * Removes argument from #email_from (facepalm) * Reverts changes to application_mailer and notify_mailer_spec * Removes default "Community" topic from application_mailer and makes topic optional * Refactors #prepopulate_new_form to resolve Code Climate failures * Refactors #email_from even further by use of a ternary operator per review suggestion * Simplifies the data_update script used to remove collective_noun per review request * Adds a data_update script to append community to community_name * Updates data_update script to correctly append Community to community_name * Removes RemoveCollectiveNounFromConfig and updates other script * Removes superfluous false from data_update script * Updates data_update script to be more idiomatic --- app/controllers/admin/pages_controller.rb | 78 ++++++++----------- app/controllers/stories_controller.rb | 2 +- app/helpers/application_helper.rb | 8 +- .../admin/controllers/config_controller.js | 1 - app/lib/constants/site_config.rb | 6 +- app/mailers/application_mailer.rb | 8 +- app/mailers/devise_mailer.rb | 2 +- app/models/site_config.rb | 2 - app/views/admin/configs/show.html.erb | 13 ---- app/views/articles/feed.rss.builder | 4 +- app/views/articles/index.html.erb | 8 +- app/views/articles/search/_meta.html.erb | 4 +- app/views/articles/show.html.erb | 2 +- app/views/articles/tags/_meta.html.erb | 2 +- app/views/collections/_meta.html.erb | 6 +- app/views/comments/index.html.erb | 2 +- app/views/events/_event.html.erb | 2 +- app/views/events/index.html.erb | 2 +- app/views/events/show.html.erb | 2 +- app/views/layouts/_footer.html.erb | 4 +- app/views/listings/index.html.erb | 2 +- .../tag_moderator_confirmation_email.html.erb | 2 +- .../tag_moderator_confirmation_email.text.erb | 2 +- app/views/notifications/index.html.erb | 2 +- app/views/onboardings/show.html.erb | 2 +- app/views/open_search/show.xml.erb | 2 +- app/views/pages/_coc_text.html.erb | 2 +- app/views/pages/_placeholder.html.erb | 2 +- app/views/pages/badge.html.erb | 2 +- app/views/pages/badges.html.erb | 2 +- app/views/pages/code_of_conduct.html.erb | 10 +-- app/views/pages/contact.html.erb | 16 ++-- app/views/pages/privacy.html.erb | 6 +- app/views/pages/report_abuse.html.erb | 2 +- app/views/pages/show.html.erb | 8 +- app/views/pages/terms.html.erb | 14 ++-- .../_bronze_sponsor_copy.html.erb | 4 +- .../partnerships/_gold_sponsor_copy.html.erb | 2 +- .../_silver_sponsor_copy.html.erb | 2 +- .../partnerships/_tag_sponsor_copy.html.erb | 2 +- app/views/podcast_episodes/_meta.html.erb | 8 +- app/views/podcast_episodes/show.html.erb | 2 +- app/views/reading_list_items/index.html.erb | 6 +- app/views/service_worker/manifest.json.erb | 2 +- app/views/shared/_hamburger.html.erb | 2 +- app/views/shell/_top.html.erb | 4 +- app/views/tags/index.html.erb | 6 +- app/views/users/_meta.html.erb | 4 +- app/views/videos/index.html.erb | 2 +- ...4442_append_community_to_community_name.rb | 11 +++ spec/helpers/application_helper_spec.rb | 13 ---- spec/mailers/devise_mailer_spec.rb | 2 +- spec/mailers/notify_mailer_spec.rb | 28 +++---- spec/requests/admin/configs_spec.rb | 7 -- spec/requests/articles/articles_show_spec.rb | 2 +- spec/requests/service_worker_spec.rb | 2 +- spec/requests/stories_show_spec.rb | 4 +- .../admin/admin_creates_new_page_spec.rb | 2 +- .../user_visits_homepage_articles_spec.rb | 6 +- .../homepage/user_visits_homepage_spec.rb | 2 +- spec/system/videos/user_visits_videos_spec.rb | 2 +- 61 files changed, 158 insertions(+), 203 deletions(-) create mode 100644 lib/data_update_scripts/20201217184442_append_community_to_community_name.rb diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 840fac577..de09473aa 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -59,51 +59,39 @@ module Admin end def prepopulate_new_form(slug) - case slug - when "code-of-conduct" - html = view_context.render partial: "pages/coc_text", - locals: { - community_name: view_context.community_name, - community_qualified_name: view_context.community_qualified_name, - email_link: view_context.email_link - } - @page = Page.new( - slug: params[:slug], - body_html: html, - title: "Code of Conduct", - description: "A page that describes how to behave on this platform", - is_top_level_path: true, - ) - - when "privacy" - html = view_context.render partial: "pages/privacy_text", - locals: { - community_name: view_context.community_name, - email_link: view_context.email_link - } - @page = Page.new( - slug: params[:slug], - body_html: html, - title: "Privacy Policy", - description: "A page that describes the privacy policy", - is_top_level_path: true, - ) - when "terms" - html = view_context.render partial: "pages/terms_text", - locals: { - community_name: view_context.community_name, - email_link: view_context.email_link - } - @page = Page.new( - slug: params[:slug], - body_html: html, - title: "Terms of Use", - description: "A page that describes the terms of use for the application", - is_top_level_path: true, - ) - else - @page = Page.new - end + html = view_context.render partial: "pages/coc_text", + locals: { + community_name: view_context.community_name, + email_link: view_context.email_link + } + @page = case slug + when "code-of-conduct" + Page.new( + slug: params[:slug], + body_html: html, + title: "Code of Conduct", + description: "A page that describes how to behave on this platform", + is_top_level_path: true, + ) + when "privacy" + Page.new( + slug: params[:slug], + body_html: html, + title: "Privacy Policy", + description: "A page that describes the privacy policy", + is_top_level_path: true, + ) + when "terms" + Page.new( + slug: params[:slug], + body_html: html, + title: "Terms of Use", + description: "A page that describes the terms of use for the application", + is_top_level_path: true, + ) + else + Page.new + end end end end diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index 0dd562994..f8006a128 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -404,7 +404,7 @@ class StoriesController < ApplicationController "publisher": { "@context": "http://schema.org", "@type": "Organization", - "name": "#{SiteConfig.community_name} Community", + "name": SiteConfig.community_name.to_s, "logo": { "@context": "http://schema.org", "@type": "ImageObject", diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 21a1367cf..e19d6927a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -45,7 +45,7 @@ module ApplicationHelper derived_title = if page_title.include?(community_name) page_title elsif user_signed_in? - "#{page_title} - #{community_qualified_name} #{community_emoji}" + "#{page_title} - #{community_name} #{community_emoji}" else "#{page_title} - #{community_name}" end @@ -173,12 +173,6 @@ module ApplicationHelper @community_emoji ||= SiteConfig.community_emoji end - def community_qualified_name - return "#{community_name} #{SiteConfig.collective_noun}" unless SiteConfig.collective_noun_disabled - - community_name - end - def release_adjusted_cache_key(path) release_footprint = ApplicationConfig["RELEASE_FOOTPRINT"] return path if release_footprint.blank? diff --git a/app/javascript/admin/controllers/config_controller.js b/app/javascript/admin/controllers/config_controller.js index ea8577308..2eb116453 100644 --- a/app/javascript/admin/controllers/config_controller.js +++ b/app/javascript/admin/controllers/config_controller.js @@ -19,7 +19,6 @@ const emailAuthModalBody = ` export default class ConfigController extends Controller { static targets = [ 'authenticationProviders', - 'collectiveNoun', 'configModalAnchor', 'emailAuthSettingsBtn', 'enabledIndicator', diff --git a/app/lib/constants/site_config.rb b/app/lib/constants/site_config.rb index 66af7779f..7b655e1d7 100644 --- a/app/lib/constants/site_config.rb +++ b/app/lib/constants/site_config.rb @@ -45,10 +45,6 @@ module Constants description: "https://url.com/lander", placeholder: "URL campaign sidebar image will link to" }, - collective_noun: { - description: "Used to describe your collective identity.", - placeholder: "Herd" - }, community_copyright_start_year: { description: "Used to mark the year this forem was started.", placeholder: Time.zone.today.year.to_s @@ -66,7 +62,7 @@ module Constants placeholder: "user" }, community_name: { - description: "Primary name... e.g. DEV", + description: "Used as the primary name for your Forem, e.g. DEV, DEV Community, The DEV Community, etc.", placeholder: "New Forem" }, credit_prices_in_cents: { diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index f84cb4139..17afa6b3d 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -10,12 +10,14 @@ class ApplicationMailer < ActionMailer::Base before_action :use_custom_host default( - from: -> { email_from("Community") }, + from: -> { email_from }, template_path: ->(mailer) { "mailers/#{mailer.class.name.underscore}" }, ) - def email_from(topic) - "#{SiteConfig.community_name} #{topic} <#{SiteConfig.email_addresses[:default]}>" + def email_from(topic = "") + community_name = topic.present? ? "#{SiteConfig.community_name} #{topic}" : SiteConfig.community_name + + "#{community_name} <#{SiteConfig.email_addresses[:default]}>" end def generate_unsubscribe_token(id, email_type) diff --git a/app/mailers/devise_mailer.rb b/app/mailers/devise_mailer.rb index da1c85e18..c706c37c5 100644 --- a/app/mailers/devise_mailer.rb +++ b/app/mailers/devise_mailer.rb @@ -3,7 +3,7 @@ class DeviseMailer < Devise::Mailer def use_site_config_values Devise.mailer_sender = - "#{SiteConfig.community_name} #{SiteConfig.collective_noun} <#{SiteConfig.email_addresses[:default]}>" + "#{SiteConfig.community_name} <#{SiteConfig.email_addresses[:default]}>" ActionMailer::Base.default_url_options[:host] = SiteConfig.app_domain end end diff --git a/app/models/site_config.rb b/app/models/site_config.rb index 1fb0dba8e..d45701121 100644 --- a/app/models/site_config.rb +++ b/app/models/site_config.rb @@ -55,8 +55,6 @@ class SiteConfig < RailsSettings::Base # Community Content field :community_name, type: :string, default: ApplicationConfig["COMMUNITY_NAME"] || "New Forem" field :community_emoji, type: :string, default: "🌱" - field :collective_noun, type: :string, default: "Community" - field :collective_noun_disabled, type: :boolean, default: false field :community_description, type: :string field :community_member_label, type: :string, default: "user" field :tagline, type: :string diff --git a/app/views/admin/configs/show.html.erb b/app/views/admin/configs/show.html.erb index b765a310e..cc92444ab 100644 --- a/app/views/admin/configs/show.html.erb +++ b/app/views/admin/configs/show.html.erb @@ -437,19 +437,6 @@ placeholder: Constants::SiteConfig::DETAILS[:community_name][:placeholder] %> -
- Thanks so much for volunteering your time to benefit the <%= community_qualified_name %>. We sincerely appreciate your help!.
+ Thanks so much for volunteering your time to benefit <%= community_name %>. We sincerely appreciate your help!.
diff --git a/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.text.erb b/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.text.erb index 86fa78e92..2630df7b1 100644 --- a/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.text.erb +++ b/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.text.erb @@ -22,7 +22,7 @@ Tag moderation is something we're continuously iterating on, so you can expect a We regularly send out a biweekly Mod Newsletter to keep mods up to date on these changes, so look out for it! Of course, don't hesitate to reach out to us at any moment if you have any feedback — feel free to write to <%= SiteConfig.email_addresses[:contact] %> and share your thoughts. -Thanks so much for volunteering your time to benefit the <%= community_qualified_name %>. We sincerely appreciate your help! +Thanks so much for volunteering your time to benefit <%= community_name %>. We sincerely appreciate your help! Happy Modding! <%= community_name %> Team diff --git a/app/views/notifications/index.html.erb b/app/views/notifications/index.html.erb index dd23b0496..c186edf8d 100644 --- a/app/views/notifications/index.html.erb +++ b/app/views/notifications/index.html.erb @@ -9,7 +9,7 @@ " /> - + "> diff --git a/app/views/onboardings/show.html.erb b/app/views/onboardings/show.html.erb index 1a8010921..592eff8e3 100644 --- a/app/views/onboardings/show.html.erb +++ b/app/views/onboardings/show.html.erb @@ -12,7 +12,7 @@
All participants of the <%= community_qualified_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 %> .
+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 <%= 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. diff --git a/app/views/pages/_placeholder.html.erb b/app/views/pages/_placeholder.html.erb index 26f7cfbc9..13154d592 100644 --- a/app/views/pages/_placeholder.html.erb +++ b/app/views/pages/_placeholder.html.erb @@ -1,4 +1,4 @@ -<% title "#{title} #{community_qualified_name}" %> +<% title "#{title} #{community_name}" %>
- <%= community_qualified_name %> would love to hear from you! + <%= community_name %> would love to hear from you!
Email: <%= email_link %> 😁 diff --git a/app/views/pages/privacy.html.erb b/app/views/pages/privacy.html.erb index ca9cf3b82..e6da01bde 100644 --- a/app/views/pages/privacy.html.erb +++ b/app/views/pages/privacy.html.erb @@ -9,13 +9,13 @@ " /> - - + + "> - + <% end %> diff --git a/app/views/pages/report_abuse.html.erb b/app/views/pages/report_abuse.html.erb index b63e5afe1..1c0d110ae 100644 --- a/app/views/pages/report_abuse.html.erb +++ b/app/views/pages/report_abuse.html.erb @@ -7,7 +7,7 @@ " /> - + "> diff --git a/app/views/pages/show.html.erb b/app/views/pages/show.html.erb index 5defd7507..e58c2ed86 100644 --- a/app/views/pages/show.html.erb +++ b/app/views/pages/show.html.erb @@ -1,19 +1,19 @@ <% title @page.title %> <%= content_for :page_meta do %> - + <%= meta_keywords_default %> - + - + "> - + <% end %> diff --git a/app/views/pages/terms.html.erb b/app/views/pages/terms.html.erb index 83cb383b3..e94e58e92 100644 --- a/app/views/pages/terms.html.erb +++ b/app/views/pages/terms.html.erb @@ -1,21 +1,21 @@ -<% title("Terms of Use for the #{community_qualified_name}") %> +<% title("Terms of Use for #{community_name}") %> <%= content_for :page_meta do %> " /> - + <%= meta_keywords_default %> " /> - + - - + + "> - - + + <% end %> diff --git a/app/views/partnerships/_bronze_sponsor_copy.html.erb b/app/views/partnerships/_bronze_sponsor_copy.html.erb index 758991b4f..d4950060e 100644 --- a/app/views/partnerships/_bronze_sponsor_copy.html.erb +++ b/app/views/partnerships/_bronze_sponsor_copy.html.erb @@ -1,7 +1,7 @@
- Thank you for supporting the <%= community_qualified_name %>! Here’s what to expect with a Bronze Sponsorship: + Thank you for supporting <%= community_name %>! Here’s what to expect with a Bronze Sponsorship:
- As a Bronze sponsor, you will receive special flair that lives on your organization page. This visual cue will show the <%= community_qualified_name %> and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community. + As a Bronze sponsor, you will receive special flair that lives on your organization page. This visual cue will show <%= community_name %> and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community.
<% if user_signed_in? %>-As a Gold sponsor, you will receive special flair that lives on your organization page. This visual cue will show the <%= community_qualified_name %> and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community. +As a Gold sponsor, you will receive special flair that lives on your organization page. This visual cue will show <%= community_name %> and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community.
<% unless user_signed_in? %>- As a Silver sponsor, you will receive special flair that lives on your organization page. This visual cue will show the <%= community_qualified_name %> and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community. + As a Silver sponsor, you will receive special flair that lives on your organization page. This visual cue will show <%= community_name %> and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community.
<% if user_signed_in? %>- Members of the <%= community_qualified_name %> head to the dedicated tags page to explore new areas of the site, and to manage which tags they follow. Your company will be listed as a sponsor directly alongside the tag you support. This placement provides visibility to all members, even if they don’t directly engage within your tag. + Members of <%= community_name %> head to the dedicated tags page to explore new areas of the site, and to manage which tags they follow. Your company will be listed as a sponsor directly alongside the tag you support. This placement provides visibility to all members, even if they don’t directly engage within your tag.