Removing the stackbit integration (#15701)

* Removing the stackbit integration

The feature didn't quite work and Stackbit no longer supports this
integration.

Yes there are a few places where the webhooks has a string of "stackbit"
but I'm hesitant to remove that, as they are the part of the Webhooks
tests.

Closes #15700

* Update lib/data_update_scripts/20211206222716_remove_stackbit_page.rb

Co-authored-by: Michael Kohl <citizen428@forem.com>

Co-authored-by: Michael Kohl <citizen428@forem.com>
This commit is contained in:
Jeremy Friesen 2021-12-08 10:20:15 -05:00 committed by GitHub
parent fda9cf9272
commit bd36ed087b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 23 additions and 74 deletions

View file

@ -97,10 +97,6 @@ class UserDecorator < ApplicationDecorator
articles_count.zero? && comments_count.zero? && suspended?
end
def stackbit_integration?
access_tokens.any?
end
def considered_new?
Settings::RateLimit.user_considered_new?(user: self)
end

View file

@ -22,5 +22,4 @@
<% end %>
</div>
<%= render partial: "integrations" %>
<%= render partial: "users/integrations_github_repositories", locals: { show_integration: @github_repositories_show } %>

View file

@ -1,23 +0,0 @@
<div class="crayons-card crayons-card--content-rows">
<h2 class="crayons-subtitle-1">
<%= t "views.settings.extensions.generate", community: community_name %>
</h2>
<div class="single-app-integration">
<% if current_user.decorate.stackbit_integration? %>
<h3><%= t("views.settings.extensions.stackbit.connected") %> <sup><%= t("core.beta") %></sup><img width="20px" style="margin-left:2px;" src="<%= asset_path("checkmark-green.svg") %>" /></h3>
<p style="font-size: 1.1em"><strong><a href="https://app.stackbit.com/dashboard"><%= t("views.settings.extensions.stackbit.goto") %></a></strong></p>
<p style="font-size: 1.1em"><strong><a href="https://app.stackbit.com/create?ref=devto"><%= t("views.settings.extensions.stackbit.create") %></a></strong></p>
<% else %>
<h3 class="crayons-subtitle-2 flex items-center">
<%= t("views.settings.extensions.stackbit.connect") %>
<span class="ml-2 crayons-indicator crayons-indicator--accent"><%= t("core.beta") %></span>
</h3>
<p class="mb-4">
<%= t("views.settings.extensions.stackbit.desc", community: community_name) %>
</p>
<a href="/connecting-with-stackbit" class="crayons-btn">
<%= t("views.settings.extensions.stackbit.start") %>
</a>
<% end %>
</div>
</div>

View file

@ -163,13 +163,6 @@ en:
submit: Submit Feed Settings
save_connect: Save Connect Settings
save_web: Save Web Monetization Settings
stackbit:
connect: Connect to Stackbit
connected: Connected to Stackbit
create: Create New Stackbit Site
desc: Automatically generate a self-hosted static blog feed from your %{community} posts.
goto: Go To Your Stackbit Dashboard
start: Get Started
web: Web monetization
finalize_html: You have requested a change to %{email}. Check your inbox for the verification link to finalize the change.
for_html: Settings for %{name}

View file

@ -163,13 +163,6 @@ fr:
submit: Submit Feed Settings
save_connect: Save Connect Settings
save_web: Save Web Monetization Settings
stackbit:
connect: Connect to Stackbit
connected: Connected to Stackbit
create: Create New Stackbit Site
desc: Automatically generate a self-hosted static blog feed from your %{community} posts.
goto: Go To Your Stackbit Dashboard
start: Get Started
web: Web monetization
finalize_html: You have requested a change to %{email}. Check your inbox for the verification link to finalize the change.
for_html: Settings for %{name}

View file

@ -0,0 +1,7 @@
module DataUpdateScripts
class RemoveStackbitPage
def run
Page.destroy_by(slug: "connecting-with-stackbit")
end
end
end

View file

@ -167,17 +167,6 @@ RSpec.describe UserDecorator, type: :decorator do
end
end
describe "#stackbit_integration?" do
it "returns false by default" do
expect(user.decorate.stackbit_integration?).to be(false)
end
it "returns true if the user has access tokens" do
user.access_tokens.build
expect(user.decorate.stackbit_integration?).to be(true)
end
end
describe "#considered_new?" do
let(:decorated_user) { user.decorate }

View file

@ -0,0 +1,15 @@
require "rails_helper"
require Rails.root.join(
"lib/data_update_scripts/20211206222716_remove_stackbit_page.rb",
)
describe DataUpdateScripts::RemoveStackbitPage do
it "idempotently destroys the Stackbit page" do
create(:page, slug: "connecting-with-stackbit")
expect { described_class.new.run }
.to change(Page, :count).by(-1)
expect { described_class.new.run }
.not_to change(Page, :count)
end
end

View file

@ -83,8 +83,7 @@ RSpec.describe "UserSettings", type: :request do
get user_settings_path(:extensions)
feed_section = "Publishing to #{Settings::Community.community_name} from RSS"
stackbit_section = "Generate a personal blog from your #{Settings::Community.community_name} posts"
titles = ["Comment templates", feed_section, "Web monetization", stackbit_section]
titles = ["Comment templates", feed_section, "Web monetization"]
expect(response.body).to include(*titles)
end

View file

@ -19,25 +19,6 @@ RSpec.describe "User edits their extensions", type: :system, js: true do
.to_return(status: 200, body: github_response_body.to_json, headers: { "Content-Type" => "application/json" })
end
describe "Stackbit" do
before do
visit user_settings_path
end
it "has connect-to-stackbit prompt" do
click_link "Extensions"
expect(page).to have_text("Connect to Stackbit")
end
it "has connected-to-stackbit prompt if already integrated" do
create(:doorkeeper_access_token, resource_owner: user)
click_link "Extensions"
expect(page).to have_text("Connected to Stackbit")
end
end
describe "Feed" do
before do
visit user_settings_path(:extensions)