From 7d4a7cc8833b0bc1317f76993e78a6b58ad767a6 Mon Sep 17 00:00:00 2001 From: Josh Puetz Date: Fri, 7 Aug 2020 18:52:39 -0500 Subject: [PATCH] [deploy] Change lingering `/internal` paths to `/admin` (#9673) * Change lingering `/internal` paths to `/admin` * Fix multiline test expectation --- .github/CODEOWNERS | 12 ++-- .simplecov | 2 +- app/helpers/application_helper.rb | 8 --- app/lib/url.rb | 8 --- app/views/moderations/mod.html.erb | 2 +- app/views/pages/_placeholder.html.erb | 2 +- app/views/pages/robots.text.erb | 2 +- app/views/tags/edit.html.erb | 2 +- docs/creators/configure-forem.md | 76 +++++++++++++++++-------- spec/helpers/application_helper_spec.rb | 11 ++-- spec/lib/url_spec.rb | 8 +-- spec/requests/buffer_updates_spec.rb | 21 ------- 12 files changed, 73 insertions(+), 81 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 99cc613a3..bea6225cd 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,18 +3,18 @@ # for further details /*.md @forem/oss -/app/assets/stylesheets/internal/ @forem/snackcase +/app/assets/stylesheets/admin/ @forem/snackcase /app/controllers/articles_controller.rb @forem/hells-bells -/app/controllers/internal/ @forem/snackcase +/app/controllers/admin/ @forem/snackcase /app/services/notifications/ @forem/delightful /app/controllers/notifications/ @forem/delightful /app/workers/notifications/ @forem/delightful -/app/controllers/internal/broadcasts_controller.rb @forem/delightful +/app/controllers/admin/broadcasts_controller.rb @forem/delightful /app/controllers/async_info_controller.rb @forem/sre /app/controllers/stories_controller.rb @forem/hells-bells /app/services/search/ @forem/sre /app/views/articles/ @forem/hells-bells -/app/views/internal/ @forem/snackcase +/app/views/admin/ @forem/snackcase /app/views/moderation/ @forem/snackcase /app/views/notifications/ @forem/delightful /app/views/stories/ @forem/hells-bells @@ -25,9 +25,9 @@ /lib/data_update_scripts/ @forem/sre /lib/sidekiq/ @forem/sre /spec/rails_helper.rb @forem/sre -/spec/requests/internal/ @forem/snackcase +/spec/requests/admin/ @forem/snackcase /spec/support/ @forem/sre -/spec/system/internal/ @forem/snackcase +/spec/system/admin/ @forem/snackcase Gemfile @forem/sre @forem/oss Gemfile.lock @forem/sre @forem/oss package.json @forem/oss @nickytonline diff --git a/.simplecov b/.simplecov index 51bfd4615..666eee4dd 100644 --- a/.simplecov +++ b/.simplecov @@ -3,7 +3,7 @@ unless ENV["COVERAGE"] == "false" add_filter "/spec/" add_filter "/dashboards/" add_filter "/app/controllers/admin/" - add_filter "/app/controllers/internal/" + add_filter "/app/controllers/resource_admin/" add_filter "/app/black_box/" add_filter "/app/fields/" add_filter "/app/views/admin/" diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1986a78f8..ac63b597c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -211,14 +211,6 @@ module ApplicationHelper SiteConfig.community_member_label.pluralize end - # Creates an app internal URL - # - # @note Uses protocol and domain specified in the environment, ensure they are set. - # @param uri [URI, String] parts we want to merge into the URL, e.g. path, fragment - # @example Retrieve the base URL - # app_url #=> "https://dev.to" - # @example Add a path - # app_url("internal") #=> "https://dev.to/internal" def app_url(uri = nil) URL.url(uri) end diff --git a/app/lib/url.rb b/app/lib/url.rb index bd7d4d011..1e402bdea 100644 --- a/app/lib/url.rb +++ b/app/lib/url.rb @@ -10,14 +10,6 @@ module URL ApplicationConfig["APP_DOMAIN"] end - # Creates an app URL - # - # @note Uses protocol and domain specified in the environment, ensure they are set. - # @param uri [URI, String] parts we want to merge into the URL, e.g. path, fragment - # @example Retrieve the base URL - # app_url #=> "https://dev.to" - # @example Add a path - # app_url("internal") #=> "https://dev.to/internal" def self.url(uri = nil) base_url = "#{protocol}#{domain}" return base_url unless uri diff --git a/app/views/moderations/mod.html.erb b/app/views/moderations/mod.html.erb index 39f7c0a8b..af35ddfb8 100644 --- a/app/views/moderations/mod.html.erb +++ b/app/views/moderations/mod.html.erb @@ -63,7 +63,7 @@ <% if current_user.has_role?(:super_admin) && @moderatable.class.name == "Article" %>

Edit Post | - Internal:Article | + ResourceAdmin:Article | Admin:Article

<% elsif current_user.has_role?(:super_admin) && @moderatable.class.name == "Comment" %>

Admin:Comment | diff --git a/app/views/pages/_placeholder.html.erb b/app/views/pages/_placeholder.html.erb index 8db2a3fd4..9fa130ea6 100644 --- a/app/views/pages/_placeholder.html.erb +++ b/app/views/pages/_placeholder.html.erb @@ -4,6 +4,6 @@

<%= title %>

-

The production <%= title %> page is a page generated at /internal/pages! This one is just a placeholder.

+

The production <%= title %> page is a page generated at /admin/pages! This one is just a placeholder.

diff --git a/app/views/pages/robots.text.erb b/app/views/pages/robots.text.erb index 2c5073003..8aa00bcda 100644 --- a/app/views/pages/robots.text.erb +++ b/app/views/pages/robots.text.erb @@ -8,7 +8,7 @@ Disallow: /search/?q=* Disallow: /listings*?q=* Disallow: /mod/* Disallow: /mod?* -Disallow: /internal/* +Disallow: /resource_admin/* Disallow: /admin/* Sitemap: https://<%= ApplicationConfig["AWS_BUCKET_NAME"] %>.s3.amazonaws.com/sitemaps/sitemap.xml.gz diff --git a/app/views/tags/edit.html.erb b/app/views/tags/edit.html.erb index 6faebff7a..8c0090f24 100644 --- a/app/views/tags/edit.html.erb +++ b/app/views/tags/edit.html.erb @@ -88,7 +88,7 @@ <% if current_user.has_role?(:super_admin) || current_user.has_role?(:admin) %>
-

<%= @tag.name %> admin

+

<%= @tag.name %> admin




diff --git a/docs/creators/configure-forem.md b/docs/creators/configure-forem.md index 1ca0e7e92..96480ed79 100644 --- a/docs/creators/configure-forem.md +++ b/docs/creators/configure-forem.md @@ -6,63 +6,91 @@ title: Configuring Forem ## Overview -As a Forem admin, one of the first steps of managing your site will be to tailor your content, branding and other important details based on your community goals. This is made simple by the configuration page which can be found at https://your.forem.url/internal/config. +As a Forem admin, one of the first steps of managing your site will be to tailor +your content, branding and other important details based on your community +goals. This is made simple by the configuration page which can be found at +https://your.forem.url/admin/config. -_We advise that you first complete the minimum set up before sending out your Forem link to your community._ +_We advise that you first complete the minimum set up before sending out your +Forem link to your community._ ## Complete your Set Up, Configure your Forem -Once your Forem instance is set up for the first time, you will most likely see the following banner: +Once your Forem instance is set up for the first time, you will most likely see +the following banner: ![Banner showing outstanding site configuration](https://dev-to-uploads.s3.amazonaws.com/i/2nosvfr7l47ymipmyh4o.png) -This banner indicates that the Forem configuration process hasn't been completed yet. +This banner indicates that the Forem configuration process hasn't been completed +yet. -When you click on the link on banner, it will take you to the configuration page (i.e. https://your.forem.url/internal/config). +When you click on the link on banner, it will take you to the configuration page +(i.e. https://your.forem.url/admin/config). -On this page you will see that the Get Started section is expanded. It contains all the mandatory fields that need to be filled out in order for the site to be in a usable state. Once it is filled out and submitted, the banner will then disappear. +On this page you will see that the Get Started section is expanded. It contains +all the mandatory fields that need to be filled out in order for the site to be +in a usable state. Once it is filled out and submitted, the banner will then +disappear. ## Access and Permissions -The following permissions are required to be able to view and/or edit the config page: +The following permissions are required to be able to view and/or edit the config +page: -#### Role: super\_admin -When providing this role to a user they will be able to access the config page. However, this page will be a read only view for them. They will see the following: +#### Role: super_admin + +When providing this role to a user they will be able to access the config page. +However, this page will be a read only view for them. They will see the +following: ![Super Admin Permissions Role Provided](https://dev-to-uploads.s3.amazonaws.com/i/xpc8g9x46vzgi49ohc0d.png) -#### Role: single\_resource\_admin -When providing this role to a user they will be able to access the config page, and they will be able to edit the config variables. +#### Role: single_resource_admin + +When providing this role to a user they will be able to access the config page, +and they will be able to edit the config variables. ![Super Resource Admin Role Provided](https://dev-to-uploads.s3.amazonaws.com/i/z5v2ou64imgqonmefolk.png) -The first admin of your Forem will be given the highest permissions. Thereafter, they can provide the necessary permissions to subsequent users via the https://your.forem.url/internal/permissions. +The first admin of your Forem will be given the highest permissions. Thereafter, +they can provide the necessary permissions to subsequent users via the +https://your.forem.url/admin/permissions. ## The Configuration Sections Currently, the configuration page is split into 3 sections. They are as follows: -- A **Get Started section** that contains all required fields. - These are the fields that are required to be filled out, in order to get your Forem in a usable state. -- An **All Site Configuration section** that contains all the possible variables that you can configure on the site. - This section is broken down into sub sections, whereby each subsection will contain a description of what it does, - and then list the fields that are available for configuration. Each field will also contain a concise description - of what it is used for. -- An **Environment Variables section** that provides a read-only view of the environment variables that are - available to be set on the server. - If your instance is hosted by Forem, please get in touch with customer support to change any of these variables. +- A **Get Started section** that contains all required fields. These are the + fields that are required to be filled out, in order to get your Forem in a + usable state. +- An **All Site Configuration section** that contains all the possible variables + that you can configure on the site. This section is broken down into sub + sections, whereby each subsection will contain a description of what it does, + and then list the fields that are available for configuration. Each field will + also contain a concise description of what it is used for. +- An **Environment Variables section** that provides a read-only view of the + environment variables that are available to be set on the server. If your + instance is hosted by Forem, please get in touch with customer support to + change any of these variables. ![The Site Configuration Sections](https://dev-to-uploads.s3.amazonaws.com/i/o5p6kob6ctkzy38gw9vt.png) -All required fields are marked as such. In addition, you will notice that we have set some defaults for certain fields, you may amend them as you see relevant for your Forem. +All required fields are marked as such. In addition, you will notice that we +have set some defaults for certain fields, you may amend them as you see +relevant for your Forem. ## Updating your configurations -In order to update any of the variables within the Get Started and All Site Configuration sections, you will set the new value and then navigate to the end of the section where you will verify that you would like to make the change by typing the following sentence: +In order to update any of the variables within the Get Started and All Site +Configuration sections, you will set the new value and then navigate to the end +of the section where you will verify that you would like to make the change by +typing the following sentence: + ``` My username is and this action is 100% safe and appropriate. ``` -You will now see your updated values and the changes on your site will be in effect. +You will now see your updated values and the changes on your site will be in +effect. ![Submit your data](https://dev-to-uploads.s3.amazonaws.com/i/xo0nxykuu8kw984w088n.png) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 88d5c0273..d21ba944b 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -81,16 +81,16 @@ RSpec.describe ApplicationHelper, type: :helper do end it "creates a URL with a path" do - expect(app_url("internal")).to eq("https://dev.to/internal") + expect(app_url("admin")).to eq("https://dev.to/admin") end it "creates the correct URL even if the path starts with a slash" do - expect(app_url("/internal")).to eq("https://dev.to/internal") + expect(app_url("/admin")).to eq("https://dev.to/admin") end it "works when called with an URI object" do - uri = URI::Generic.build(path: "internal", fragment: "test") - expect(app_url(uri)).to eq("https://dev.to/internal#test") + uri = URI::Generic.build(path: "resource_admin", fragment: "test") + expect(app_url(uri)).to eq("https://dev.to/resource_admin#test") end end @@ -120,7 +120,8 @@ RSpec.describe ApplicationHelper, type: :helper do end it "has the correct text in the a tag" do - expect(helper.collection_link(collection)).to have_text("#{collection.slug} (#{collection.articles.published.size} Part Series)") + expect(helper.collection_link(collection)) + .to have_text("#{collection.slug} (#{collection.articles.published.size} Part Series)") end end diff --git a/spec/lib/url_spec.rb b/spec/lib/url_spec.rb index 07973af1b..c13c89f23 100644 --- a/spec/lib/url_spec.rb +++ b/spec/lib/url_spec.rb @@ -24,16 +24,16 @@ RSpec.describe URL, type: :lib do end it "creates a URL with a path" do - expect(described_class.url("internal")).to eq("https://dev.to/internal") + expect(described_class.url("admin")).to eq("https://dev.to/admin") end it "creates the correct URL even if the path starts with a slash" do - expect(described_class.url("/internal")).to eq("https://dev.to/internal") + expect(described_class.url("/admin")).to eq("https://dev.to/admin") end it "works when called with an URI object" do - uri = URI::Generic.build(path: "internal", fragment: "test") - expect(described_class.url(uri)).to eq("https://dev.to/internal#test") + uri = URI::Generic.build(path: "admin", fragment: "test") + expect(described_class.url(uri)).to eq("https://dev.to/admin#test") end end diff --git a/spec/requests/buffer_updates_spec.rb b/spec/requests/buffer_updates_spec.rb index afe43fa55..a2eb020cb 100644 --- a/spec/requests/buffer_updates_spec.rb +++ b/spec/requests/buffer_updates_spec.rb @@ -71,25 +71,4 @@ RSpec.describe "BufferUpdates", type: :request do expect(BufferUpdate.first.body_text).to include(article.path) end end - - # it "updates last buffered at" do - # post "/internal/buffer_updates", - # params: - # { social_channel: "main_twitter", article_id: article.id, tweet: "Hello this is a test" } - # expect(article.reload.last_buffered).not_to eq(nil) - # end - - # it "updates last buffered at with satellite buffer" do - # post "/internal/buffer_updates", - # params: - # { social_channel: "satellite_twitter", article_id: article.id, tweet: "Hello this is a test" } - # expect(article.reload.last_buffered).not_to eq(nil) - # end - - # it "updates last facebook buffered at" do - # post "/internal/buffer_updates", - # params: - # { social_channel: "facebook", article_id: article.id, tweet: "Hello this is a test" } - # expect(article.reload.facebook_last_buffered).not_to eq(nil) - # end end