diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 4126a4279..5e22807a7 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -4,10 +4,17 @@ module Admin def index @pages = Page.all + @code_of_conduct = Page.find_by(slug: "code-of-conduct") + @privacy = Page.find_by(slug: "privacy") + @terms = Page.find_by(slug: "terms") end def new - @page = Page.new + if params[:slug] + prepopulate_new_form params[:slug] + else + @page = Page.new + end end def edit @@ -39,5 +46,51 @@ module Admin social_image] params.require(:page).permit(allowed_params) end + + def prepopulate_new_form(slug) + if slug == "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, + ) + elsif slug == "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, + ) + elsif slug == "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 + end end end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index f92bf2fc9..d1658cab7 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -28,6 +28,12 @@ class PagesController < ApplicationController set_surrogate_key_header "bounty_page" end + def code_of_conduct + @page = Page.find_by(slug: "code-of-conduct") + render :show if @page + set_surrogate_key_header "code_of_conduct_page" + end + def community_moderation @page = Page.find_by(slug: "community-moderation") render :show if @page @@ -40,12 +46,24 @@ class PagesController < ApplicationController set_surrogate_key_header "faq_page" end + def privacy + @page = Page.find_by(slug: "privacy") + render :show if @page + set_surrogate_key_header "privacy_page" + end + def post_a_job @page = Page.find_by(slug: "post-a-job") render :show if @page set_surrogate_key_header "post_a_job_page" end + def terms + @page = Page.find_by(slug: "terms") + render :show if @page + set_surrogate_key_header "terms_page" + end + def tag_moderation @page = Page.find_by(slug: "tag-moderation") render :show if @page diff --git a/app/views/admin/pages/index.html.erb b/app/views/admin/pages/index.html.erb index a87b0ecf9..2c81364ca 100644 --- a/app/views/admin/pages/index.html.erb +++ b/app/views/admin/pages/index.html.erb @@ -2,14 +2,51 @@

Pages

- <%= link_to "New page", new_admin_page_path, class: "btn btn-primary ml-auto" %> + <%= link_to "New page", new_admin_page_path, class: "ml-auto crayons-btn crayons-btn--s" %>
-
+
<% @pages.each do |page| %>
- <%= link_to page.title, edit_admin_page_path(page.id) %> - <%= link_to "View", page.path, class: "ml-auto btn btn-secondary" %> + <%= link_to page.title, page.path %> + <%= link_to "Edit", edit_admin_page_path(page.id), class: "ml-auto crayons-btn crayons-btn--s crayons-btn--secondary" %>
<% end %>
+ +
+
+ <% if !@code_of_conduct || !@privacy || !@terms%> +

Override defaults

+
+ Note: Proceed with caution. When you edit any of the following pages, it will diverge from the original Forem version and you will no longer receive updates. You will see your updated version in the section above. +
+
+ <% if !@code_of_conduct %> +
+ <%= link_to "Code of Conduct", code_of_conduct_path %> + <%= link_to "Override", new_admin_page_path(slug: "code-of-conduct"), class: "ml-auto crayons-btn crayons-btn--s crayons-btn--danger" %> +
+ <% end %> + <% if !@privacy %> +
+ <%= link_to "Privacy Policy", privacy_path %> + <%= link_to "Override", new_admin_page_path(slug: "privacy"), class: "ml-auto crayons-btn crayons-btn--s crayons-btn--danger" %> +
+ <% end %> + <% if !@terms %> +
+ <%= link_to "Terms of Use", terms_path %> + <%= link_to "Override", new_admin_page_path(slug: "terms"), class: "ml-auto crayons-btn crayons-btn--s crayons-btn--danger" %> +
+ <% end %> +
+ <% else %> +
+ Note: You have overridden the code of conduct, privacy policy and terms of use. You will no longer receive updates on these pages from the Forem team. +
+ <% end %> +
+ + +
diff --git a/app/views/pages/_privacy_text.html.erb b/app/views/pages/_privacy_text.html.erb new file mode 100644 index 000000000..9764f4b49 --- /dev/null +++ b/app/views/pages/_privacy_text.html.erb @@ -0,0 +1,156 @@ +

Effective May 25, 2018

+

This policy covers <%= community_name %>.

+

What information <%= community_name %> collects and Why

+

In order to give you the best possible experience using <%= community_name %>, we collect information from your interactions with our network. We use common internet technologies, such as cookies and web server logs. We collect this basic information from everybody, whether they have an account or not.

+

The information we collect about all visitors to our website includes:

+ +

We use this information to:

+ +

In order for you to create an account on <%= community_name %> and use our Services, we need to collect and process certain information. Depending on your use of the Services, that may include:

+ +

Information Disclosure

+

We do not share, sell, rent, or trade User Personal Information with third parties for commercial purposes. +
+
+ We do share certain aggregated, non-personally identifying information with others about how our users, collectively, use <%= community_name %>. For example, we may share information pertaining to the popularity of different programming languages for advertising partners. +
+
+ We do host first-party advertising on <%= community_name %>. We do not run any code from advertisers and all ad images are hosted on managed <%= community_name %> servers. For more details, see our section on Advertising Details. +
+
+ We may use User Personal Information with your permission, so we can perform services you have authorized. For example, if you indicate you are looking for work, we may contact you with opportunities. +
+
+ We may share User Personal Information with a limited number of third party vendors who process it on our behalf to provide or improve our service, and who have agreed to privacy restrictions similar to our own Privacy Statement. Our third party vendors are listed below. +

+

Advertising Details

+

We target advertisements based solely upon:

+ +

We may place ads in:

+ +

All registered members have the ability to disable advertisements — where reasonable — through their Settings page. For instance, it’s not feasible to disable certain advertisements in the form of recognition posts, site-wide contests, dedicated sponsorship page, etc.

+

Third Party Vendors

+

+ We may share your account information with third parties in some circumstances, including: (1) with your consent; (2) to a service provider or partner who meets our data protection standards; (3) for survey or research purposes, after aggregation, anonymization, or pseudonomization; (4) when we have a good faith belief it is required by law, such as pursuant to a subpoena or other legal process; (5) when we have a good faith belief that doing so will help prevent imminent harm to someone. +

+

Data Storage +
+ <%= community_name %> uses third-party vendors and hosting partners for hardware, software, networking, storage, and related technology we need to run <%= community_name %>. By using <%= community_name %> Services, you authorize <%= community_name %> to transfer, store, and use your information in the United States and any other country where we operate. All service providers and third-party vendors are required to meet our data protection standards. +

+

Site monitoring +
+ <%= community_name %> uses a variety of third-party services to diagnose errors and improve the performance of our site. We aim to minimize the amount of personal information shared, but the information may include your IP address or other identifying information. All service providers and third-party vendors are required to meet our data protection standards. +

+

Payment processing +
+ <%= community_name %> does not process payments directly — we rely on third-party services such as Stripe, Shopify, and Paypal to receive payments and store any payment information. + <% if SiteConfig.shop_url.present? %> + The <%= community_name %> Shop is run through Shopify, a third-party e-commerce platform with their own Privacy Policy. + <% end %> +

+

Third-Party Embeds +
+ Some of the content that you see displayed on <%= community_name %> is not hosted by <%= community_name %>. These + “embeds” are hosted by a third-party and embedded in <%= community_name %>. For example: YouTube videos, Codepens, + Twitter tweets, or GitHub code that appear within a <%= community_name %> post. These files send data to the hosted + site just as if you were visiting that site directly (for example, when you load a <%= community_name %> post page with + a YouTube video embedded in it, YouTube receives data about your activity). <%= community_name %> does not control what + data third parties collect in cases like this, or what they will do with it. Third-party embeds on <%= community_name %> + are not covered by this privacy policy; they are covered by the privacy policy of the third-party service. Be mindful + when interacting with these services. +

+

Facebook (visitor action pixel) +
+ We use the “visitor action pixels” from Facebook Inc on our website. +
+
+ This allows user behavior to be tracked after they have been redirected to our website by clicking on a Facebook ad. This enables us to measure the effectiveness of Facebook ads. The data collected in this way is anonymous to us, i.e. we do not see the personal data of individual users. However, this data is stored and processed by Facebook, which is why we are informing you, based on our knowledge of the situation. Facebook may link this information to your Facebook account and also use it for its own promotional purposes, in accordance with + Facebook’s Data Usage Policy. You can object to the collection of your data by Facebook pixel, or to the use of your data for the purpose of displaying Facebook ads by contacting the following address: https://www.facebook.com/settings?tab=ads. +

+

Tracking & Cookies +
+ We use browser cookies and similar technologies to recognize you when you return to our Services. Third-party vendors may also use cookies for various reasons. +
+
+ <%= community_name %> uses a specific cookie in order to facilitate the use of Google Universal Analytics for users + logged-in to the Applications or the Platforms (“Logged-In User). If you are a Logged-In User, <%= community_name %> + may use your <%= community_name %> user ID in combination with Google Universal Analytics and Google Analytics to track + and analyze the pages of the Services you visit. We do this only to better understand how you use the Website and the + other Services, with a view to offering improvements for all <%= community_name %> users; and to tailor our business + and marketing activities accordingly, both generally and specifically to you. Google Analytics cookies do not provide + <%= community_name %> with any Personal Information.You can prevent Google Analytics from recognizing you on return + visits to this site by disabling cookies on your browser. +
+
+ You may opt-out of this feature by installing the Google Analytics Opt-out Browser Add-on, by setting your web browser to refuse cookies, or by setting your browser to alert you when cookies are being sent. If you do so, note that some parts of the Site may not function properly. +

+

Data Security +
+ We use encryption (HTTPS/TLS) to protect data transmitted to and from our site. However, no data transmission over the Internet is 100% secure, so we can’t guarantee security. You use the Service at your own risk, and you’re responsible for taking reasonable measures to secure your account. +

+

Administrative Emails from <%= community_name %> +
+ Sometimes we’ll send you emails about your account, service changes or new policies. You can’t opt out of this type of “transactional” email (unless you delete your account). +
+
+ When you interact with a transactional email sent from <%= community_name %> (such as opening an email or clicking on a particular link in an email), we may receive information about that interaction. +

+

Non-administrative Emails from <%= community_name %> +
+ Upon creating a <%= community_name %> account, you will be opted into the <%= community_name %> Newsletter and other non-administrative email. Your email address and user profile information may be stored by a third-party email provider such as MailChimp or Sendgrid. You can opt out of non-administrative emails such as digests, newsletters, and activity notifications through your account’s “Settings” page and at the link of the footer in any non-administrative email you receive from us. +
+
+ When you interact with a non-administrative email sent from <%= community_name %> (such as opening an email or clicking on a particular link in an email), we may receive information about that interaction. +

+

Deleting Your Personal Information +
+ You may request deletion of your personal information and account by emailing <%= email_link(:privacy) %>. +
+
+ To protect information from accidental or malicious destruction, we may maintain residual copies for a brief time period. But, if you delete your account, your information and content will be unrecoverable after that time. +

+

Data Portability +
+ If you would like to request a copy of your user data, please email <%= email_link(:privacy) %>.

+

Business Transfers +
+ If we are involved in a merger, acquisition, bankruptcy, reorganization or sale of assets such that your information would be transferred or become subject to a different privacy policy, we’ll notify you in advance of any such change. +

+

Changes to this Policy +
+ We reserve the right to revise this Privacy Policy at any time. If we change this Privacy Policy in the future, we will post the revised Privacy Policy and update the “Effective Date,” above, to reflect the date of the changes. +

+

Questions +
+ We welcome feedback about this policy at <%= email_link(:privacy) %>.

diff --git a/app/views/pages/privacy.html.erb b/app/views/pages/privacy.html.erb index 5113a36b1..ca9cf3b82 100644 --- a/app/views/pages/privacy.html.erb +++ b/app/views/pages/privacy.html.erb @@ -22,162 +22,6 @@

Privacy Policy

- -

Effective May 25, 2018

-

This policy covers <%= community_name %>.

-

What information <%= community_name %> collects and Why

-

In order to give you the best possible experience using <%= community_name %>, we collect information from your interactions with our network. We use common internet technologies, such as cookies and web server logs. We collect this basic information from everybody, whether they have an account or not.

-

The information we collect about all visitors to our website includes:

-
    -
  • The visitor’s browser type
  • -
  • Referring site
  • -
  • The date and time of each visitor request
  • -
  • We also collect potentially personally-identifying information like Internet Protocol (IP) addresses.
  • -
-

We use this information to:

-
    -
  • Provide, test, improve, promote and personalize <%= community_name %> Services
  • -
  • Fight spam and other forms of abuse
  • -
  • Generate aggregate, non-identifying information about how people use <%= community_name %> Services
  • -
-

In order for you to create an account on <%= community_name %> and use our Services, we need to collect and process certain information. Depending on your use of the Services, that may include:

-
    -
  • Communications you send to us (for example, when you ask for support, send us questions or comments, or report a problem);
  • -
  • Information that you submit on or to <%= community_name %> in the form of reactions, comments, or messages to other users;
  • -
  • The email address associated with your Twitter account, if you choose to sign up using your Twitter credentials. <%= community_name %> will also request permission to access additional information (these permissions are governed by Twitter’s privacy policies and can be managed through your Twitter privacy settings). We never post anything to your Twitter without your permission.
  • -
  • The email address associated with your GitHub account, if you choose to sign up using your Github credentials. <%= community_name %> will also request permission to access additional information (these permissions are governed by GitHub’s privacy policies and can be managed through your GitHub privacy settings). We never post anything to your GitHub without your permission.
  • -
  • You also have the option to give us more information if you want to, and this may include “User Personal Information.”
  • -
-

Information Disclosure

-

We do not share, sell, rent, or trade User Personal Information with third parties for commercial purposes. -
-
- We do share certain aggregated, non-personally identifying information with others about how our users, collectively, use <%= community_name %>. For example, we may share information pertaining to the popularity of different programming languages for advertising partners. -
-
- We do host first-party advertising on <%= community_name %>. We do not run any code from advertisers and all ad images are hosted on managed <%= community_name %> servers. For more details, see our section on Advertising Details. -
-
- We may use User Personal Information with your permission, so we can perform services you have authorized. For example, if you indicate you are looking for work, we may contact you with opportunities. -
-
- We may share User Personal Information with a limited number of third party vendors who process it on our behalf to provide or improve our service, and who have agreed to privacy restrictions similar to our own Privacy Statement. Our third party vendors are listed below. -

-

Advertising Details

-

We target advertisements based solely upon:

-
    -
  • Details of the page where the advertisement is shown, including: -
      -
    • The name and keywords associated with the page or article being viewed -
        -
      • We allow advertisers to target ads to a list of keywords advertising.
      • -
      -
    • -
    -
  • -
-

We may place ads in:

-
    -
  • Sidebars
  • -
  • Below articles
  • -
  • On search result pages
  • -
  • On tag pages
  • -
  • Our dedicated Sponsors page
  • -
-

All registered members have the ability to disable advertisements — where reasonable — through their Settings page. For instance, it’s not feasible to disable certain advertisements in the form of recognition posts, site-wide contests, dedicated sponsorship page, etc.

-

Third Party Vendors

-

- We may share your account information with third parties in some circumstances, including: (1) with your consent; (2) to a service provider or partner who meets our data protection standards; (3) for survey or research purposes, after aggregation, anonymization, or pseudonomization; (4) when we have a good faith belief it is required by law, such as pursuant to a subpoena or other legal process; (5) when we have a good faith belief that doing so will help prevent imminent harm to someone. -

-

Data Storage -
- <%= community_name %> uses third-party vendors and hosting partners for hardware, software, networking, storage, and related technology we need to run <%= community_name %>. By using <%= community_name %> Services, you authorize <%= community_name %> to transfer, store, and use your information in the United States and any other country where we operate. All service providers and third-party vendors are required to meet our data protection standards. -

-

Site monitoring -
- <%= community_name %> uses a variety of third-party services to diagnose errors and improve the performance of our site. We aim to minimize the amount of personal information shared, but the information may include your IP address or other identifying information. All service providers and third-party vendors are required to meet our data protection standards. -

-

Payment processing -
- <%= community_name %> does not process payments directly — we rely on third-party services such as Stripe, Shopify, and Paypal to receive payments and store any payment information. - <% if SiteConfig.shop_url.present? %> - The <%= community_name %> Shop is run through Shopify, a third-party e-commerce platform with their own Privacy Policy. - <% end %> -

-

Third-Party Embeds -
- Some of the content that you see displayed on <%= community_name %> is not hosted by <%= community_name %>. These - “embeds” are hosted by a third-party and embedded in <%= community_name %>. For example: YouTube videos, Codepens, - Twitter tweets, or GitHub code that appear within a <%= community_name %> post. These files send data to the hosted - site just as if you were visiting that site directly (for example, when you load a <%= community_name %> post page with - a YouTube video embedded in it, YouTube receives data about your activity). <%= community_name %> does not control what - data third parties collect in cases like this, or what they will do with it. Third-party embeds on <%= community_name %> - are not covered by this privacy policy; they are covered by the privacy policy of the third-party service. Be mindful - when interacting with these services. -

-

Facebook (visitor action pixel) -
- We use the “visitor action pixels” from Facebook Inc on our website. -
-
- This allows user behavior to be tracked after they have been redirected to our website by clicking on a Facebook ad. This enables us to measure the effectiveness of Facebook ads. The data collected in this way is anonymous to us, i.e. we do not see the personal data of individual users. However, this data is stored and processed by Facebook, which is why we are informing you, based on our knowledge of the situation. Facebook may link this information to your Facebook account and also use it for its own promotional purposes, in accordance with - Facebook’s Data Usage Policy. You can object to the collection of your data by Facebook pixel, or to the use of your data for the purpose of displaying Facebook ads by contacting the following address: https://www.facebook.com/settings?tab=ads. -

-

Tracking & Cookies -
- We use browser cookies and similar technologies to recognize you when you return to our Services. Third-party vendors may also use cookies for various reasons. -
-
- <%= community_name %> uses a specific cookie in order to facilitate the use of Google Universal Analytics for users - logged-in to the Applications or the Platforms (“Logged-In User). If you are a Logged-In User, <%= community_name %> - may use your <%= community_name %> user ID in combination with Google Universal Analytics and Google Analytics to track - and analyze the pages of the Services you visit. We do this only to better understand how you use the Website and the - other Services, with a view to offering improvements for all <%= community_name %> users; and to tailor our business - and marketing activities accordingly, both generally and specifically to you. Google Analytics cookies do not provide - <%= community_name %> with any Personal Information.You can prevent Google Analytics from recognizing you on return - visits to this site by disabling cookies on your browser. -
-
- You may opt-out of this feature by installing the Google Analytics Opt-out Browser Add-on, by setting your web browser to refuse cookies, or by setting your browser to alert you when cookies are being sent. If you do so, note that some parts of the Site may not function properly. -

-

Data Security -
- We use encryption (HTTPS/TLS) to protect data transmitted to and from our site. However, no data transmission over the Internet is 100% secure, so we can’t guarantee security. You use the Service at your own risk, and you’re responsible for taking reasonable measures to secure your account. -

-

Administrative Emails from <%= community_name %> -
- Sometimes we’ll send you emails about your account, service changes or new policies. You can’t opt out of this type of “transactional” email (unless you delete your account). -
-
- When you interact with a transactional email sent from <%= community_name %> (such as opening an email or clicking on a particular link in an email), we may receive information about that interaction. -

-

Non-administrative Emails from <%= community_name %> -
- Upon creating a <%= community_name %> account, you will be opted into the <%= community_name %> Newsletter and other non-administrative email. Your email address and user profile information may be stored by a third-party email provider such as MailChimp or Sendgrid. You can opt out of non-administrative emails such as digests, newsletters, and activity notifications through your account’s “Settings” page and at the link of the footer in any non-administrative email you receive from us. -
-
- When you interact with a non-administrative email sent from <%= community_name %> (such as opening an email or clicking on a particular link in an email), we may receive information about that interaction. -

-

Deleting Your Personal Information -
- You may request deletion of your personal information and account by emailing <%= email_link(:privacy) %>. -
-
- To protect information from accidental or malicious destruction, we may maintain residual copies for a brief time period. But, if you delete your account, your information and content will be unrecoverable after that time. -

-

Data Portability -
- If you would like to request a copy of your user data, please email <%= email_link(:privacy) %>.

-

Business Transfers -
- If we are involved in a merger, acquisition, bankruptcy, reorganization or sale of assets such that your information would be transferred or become subject to a different privacy policy, we’ll notify you in advance of any such change. -

-

Changes to this Policy -
- We reserve the right to revise this Privacy Policy at any time. If we change this Privacy Policy in the future, we will post the revised Privacy Policy and update the “Effective Date,” above, to reflect the date of the changes. -

-

Questions -
- We welcome feedback about this policy at <%= email_link(:privacy) %>.

+ <%= render "privacy_text" %>
diff --git a/app/views/pages/terms.html.erb b/app/views/pages/terms.html.erb index 0fe59482a..83cb383b3 100644 --- a/app/views/pages/terms.html.erb +++ b/app/views/pages/terms.html.erb @@ -22,7 +22,6 @@

Web Site Terms and Conditions of Use

- <%= render "terms_text" %>
diff --git a/spec/system/admin/admin_creates_new_page.rb b/spec/system/admin/admin_creates_new_page.rb new file mode 100644 index 000000000..676ad7686 --- /dev/null +++ b/spec/system/admin/admin_creates_new_page.rb @@ -0,0 +1,20 @@ +require "rails_helper" + +RSpec.describe "Admin creates new page", type: :system do + + let(:admin) { create(:user, :super_admin) } + + context "when we pass through a slug param" do + before do + sign_in admin + visit new_admin_page_path(slug: "code-of-conduct") + end + + it "will pre-populate the fields correctly" do + expect(find_field("page[title]").value).to eq "Code of Conduct" + expect(find_field("page[slug]").value).to eq "code-of-conduct" + expect(find_field("page[is_top_level_path]").value).to eq "1" + expect(find_field("page[body_html]").value).to include "All participants of the #{community_qualified_name} are expected to abide by our Code of Conduct," + end + end +end diff --git a/spec/system/admin/admin_manages_pages_spec.rb b/spec/system/admin/admin_manages_pages_spec.rb new file mode 100644 index 000000000..94bee3325 --- /dev/null +++ b/spec/system/admin/admin_manages_pages_spec.rb @@ -0,0 +1,90 @@ +require "rails_helper" + +RSpec.describe "Admin manages pages", type: :system do + + let(:admin) { create(:user, :super_admin) } + + before do + sign_in admin + visit admin_pages_path + end + + it "loads the view" do + expect(page).to have_content("Pages") + expect(page).to have_content("New page") + end + + describe "when there are default pages" do + it "shows an override defaults section with a warning" do + expect(page).to have_content("Override defaults") + expect(page).to have_content("Note: Proceed with caution.") + end + + it "shows the code of conduct link in the overrides section" do + within(".pages__override_defaults") do + expect(page).to have_link("Code of Conduct", href: code_of_conduct_path) + expect(page).to have_link("Override", href: new_admin_page_path(slug: "code-of-conduct")) + end + end + + it "shows the privacy policy link in the overrides section" do + within(".pages__override_defaults") do + expect(page).to have_link("Privacy Policy", href: privacy_path) + expect(page).to have_link("Override", href: new_admin_page_path(slug: "privacy")) + end + end + + it "shows the terms of use link in the overrides section" do + within(".pages__override_defaults") do + expect(page).to have_link("Terms of Use", href: terms_path) + expect(page).to have_link("Override", href: new_admin_page_path(slug: "terms")) + end + end + + it "does not show any of the links in the pages table" do + within(".pages__table") do + expect(page).to_not have_content("Terms of Use") + expect(page).to_not have_content("Code of Conduct") + expect(page).to_not have_content("Privacy Policy") + end + end + end + + describe "when the defaults are overridden" do + before do + create(:page, + slug: "code-of-conduct", + body_html: "
Code of Conduct
", + title: "Code of Conduct", + description: "A page that describes how to behave on this platform", + is_top_level_path: true) + create(:page, + slug: "privacy", + body_html: "
Privacy Policy
", + title: "Privacy Policy", + description: "A page that describes the privacy policy", is_top_level_path: true + ) + create(:page, + slug: "terms", + body_html: "
Terms of Use
", + title: "Terms of Use", + description: "A page that describes the terms of use for the application", + is_top_level_path: true + ) + sign_in admin + visit admin_pages_path + end + + it "shows the notice that the defaults have been overriden" do + expect(page).to have_content("You will no longer receive updates on these pages from the Forem team") + end + + it "shows the overriden pages in the pages table" do + within(".pages__table") do + expect(page).to have_content("Terms of Use") + expect(page).to have_content("Code of Conduct") + expect(page).to have_content("Privacy Policy") + end + end + end +end