A platform for community discussion. Free, open, simple.
DEV: Remove flowdock chat integration (#38810)
Martin Brennand011d1d910c6
diff --git a/plugins/discourse-chat-integration/config/locales/client.en.yml b/plugins/discourse-chat-integration/config/locales/client.en.ymlindex a823f1a024f..9a62d365b6b 100644--- a/plugins/discourse-chat-integration/config/locales/client.en.yml+++ b/plugins/discourse-chat-integration/config/locales/client.en.yml@@ -195,15 +195,6 @@ en:help: "The URL provided when you create a new integration in a Gitter room."#######################################- ########## FLOWDOCK STRINGS ###########- #######################################- flowdock:- title: "Flowdock"- param:- flow_token:- title: "Flow Token"- help: "The flow token provided after creating a source for a flow into which you want to send messages."- ################################################# GROUPME STRINGS ##################################################groupme:diff --git a/plugins/discourse-chat-integration/config/locales/server.en.yml b/plugins/discourse-chat-integration/config/locales/server.en.ymlindex c54ac0e006a..5164e3a26e7 100644--- a/plugins/discourse-chat-integration/config/locales/server.en.yml+++ b/plugins/discourse-chat-integration/config/locales/server.en.yml@@ -79,12 +79,6 @@ en:#######################################chat_integration_gitter_enabled: "Enable the Gitter chat integration provider"- #######################################- ########## FLOWDOCK SETTINGS ##########- #######################################- chat_integration_flowdock_enabled: "Enable the Flowdock chat integration provider"- chat_integration_flowdock_excerpt_length: "Flowdock post excerpt length"-################################################# GROUPME SETTINGS #################################################@@ -313,12 +307,6 @@ en:%{excerpt}~~~- #######################################- ########### FLOWDOCK STRINGS ##########- #######################################- flowdock:- message_title: "posted"-################################################### GOOGLE STRINGS ##################################################diff --git a/plugins/discourse-chat-integration/config/settings.yml b/plugins/discourse-chat-integration/config/settings.ymlindex 487e54d126f..6347ef3330e 100644--- a/plugins/discourse-chat-integration/config/settings.yml+++ b/plugins/discourse-chat-integration/config/settings.yml@@ -57,7 +57,7 @@ chat_integration:default: ""chat_integration_discord_excerpt_length:default: 400-+################################################# GUILDED SETTINGS ##################################################@@ -65,7 +65,7 @@ chat_integration:default: falsechat_integration_guilded_excerpt_length:default: 400-+############################################### MATTERMOST SETTINGS ##########@@ -130,15 +130,6 @@ chat_integration:chat_integration_gitter_enabled:default: false-#######################################-########## FLOWDOCK SETTINGS ##########-#######################################- chat_integration_flowdock_enabled:- default: false- chat_integration_flowdock_excerpt_length:- default: 400--################################################# GROUPME SETTINGS #################################################diff --git a/plugins/discourse-chat-integration/db/migrate/20260324004457_remove_flowdock_chat_integration.rb b/plugins/discourse-chat-integration/db/migrate/20260324004457_remove_flowdock_chat_integration.rbnew file mode 100644index 00000000000..5c2496519c3--- /dev/null+++ b/plugins/discourse-chat-integration/db/migrate/20260324004457_remove_flowdock_chat_integration.rb@@ -0,0 +1,13 @@+# frozen_string_literal: true+class RemoveFlowdockChatIntegration < ActiveRecord::Migration[8.0]+ def up+ execute <<~SQL+ DELETE FROM site_settings WHERE name = 'chat_integration_flowdock_enabled';+ DELETE FROM site_settings WHERE name = 'chat_integration_flowdock_excerpt_length';+ SQL+ end++ def down+ raise ActiveRecord::IrreversibleMigration+ end+enddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider.rbindex e3783dbf246..5397a7d8bfd 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider.rb@@ -96,7 +96,6 @@ require_relative "provider/matrix/matrix_provider"require_relative "provider/zulip/zulip_provider"require_relative "provider/rocketchat/rocketchat_provider"require_relative "provider/gitter/gitter_provider"-require_relative "provider/flowdock/flowdock_provider"require_relative "provider/groupme/groupme_provider"require_relative "provider/teams/teams_provider"require_relative "provider/powerautomate/powerautomate_provider"diff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/flowdock/flowdock_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/flowdock/flowdock_provider.rbdeleted file mode 100644index 205feebba0d..00000000000--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/flowdock/flowdock_provider.rb+++ /dev/null@@ -1,71 +0,0 @@-# frozen_string_literal: true--module DiscourseChatIntegration::Provider::FlowdockProvider- PROVIDER_NAME = "flowdock"- PROVIDER_ENABLED_SETTING = :chat_integration_flowdock_enabled- CHANNEL_IDENTIFIER_KEY = "flow_token" # this is really weird but is the only way to identify a channel in this provider- CHANNEL_PARAMETERS = [{ key: "flow_token", regex: '^\S+', unique: true, hidden: true }]-- def self.send_message(url, message)- uri = URI(url)-- http = FinalDestination::HTTP.new(uri.host, uri.port)- http.use_ssl = true-- req = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")- req.body = message.to_json- response = http.request(req)-- response- end-- def self.generate_flowdock_message(post, flow_token)- display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)-- message = {- flow_token: flow_token,- event: "discussion",- author: {- name: display_name,- avatar: post.user.small_avatar_url,- },- title: I18n.t("chat_integration.provider.flowdock.message_title"),- external_thread_id: post.topic.id,- body:- post.excerpt(- SiteSetting.chat_integration_flowdock_excerpt_length,- text_entities: true,- strip_links: false,- remap_emoji: true,- ),- thread: {- title: post.topic.title,- external_url: post.full_url,- },- }-- message- end-- def self.trigger_notification(post, channel, rule)- flow_token = channel.data["flow_token"]- message = generate_flowdock_message(post, flow_token)- response = send_message("https://api.flowdock.com/messages", message)-- unless response.kind_of?(Net::HTTPSuccess)- error_key = nil- raise DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- message: message,- response_body: response.body,- }- end- end-- def self.get_channel_by_name(name)- DiscourseChatIntegration::Channel- .with_provider(PROVIDER_NAME)- .with_data_value(CHANNEL_IDENTIFIER_KEY, name)- .first- end-enddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/flowdock/flowdock_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/flowdock/flowdock_provider_spec.rbdeleted file mode 100644index a37097c99a1..00000000000--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/flowdock/flowdock_provider_spec.rb+++ /dev/null@@ -1,52 +0,0 @@-# frozen_string_literal: true--RSpec.describe DiscourseChatIntegration::Provider::FlowdockProvider do- let(:post) { Fabricate(:post) }-- describe ".trigger_notifications" do- before { SiteSetting.chat_integration_flowdock_enabled = true }-- let(:chan1) do- DiscourseChatIntegration::Channel.create!(- provider: "flowdock",- data: {- flow_token: "5d1fe04cf66e078d6a2b579ddb8a465b",- },- )- end-- it "sends a request" do- stub1 = stub_request(:post, "https://api.flowdock.com/messages").to_return(status: 200)- described_class.trigger_notification(post, chan1, nil)- expect(stub1).to have_been_requested.once- end-- it "handles errors correctly" do- stub1 =- stub_request(:post, "https://api.flowdock.com/messages").to_return(- status: 404,- body: "{ \"error\": \"Not Found\"}",- )- expect(stub1).to have_been_requested.times(0)- expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- DiscourseChatIntegration::ProviderError,- )- expect(stub1).to have_been_requested.once- end- end-- describe ".get_channel_by_name" do- it "returns the right channel" do- expected =- DiscourseChatIntegration::Channel.create!(- provider: "flowdock",- data: {- flow_token: "5d1fe04cf66e078d6a2b579ddb8a465b",- },- )- expect(described_class.get_channel_by_name("5d1fe04cf66e078d6a2b579ddb8a465b")).to eq(- expected,- )- end- end-end