From 065d35c288ae53185f42953f7432e0bf4b1d99b9 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 12 Feb 2023 19:04:01 +0100 Subject: [PATCH] well_known/node_info: remove twitter as outbound service --- .../well_known/node_info_controller.rb | 18 ++++---- .../well_known/node_info_controller_spec.rb | 42 ++----------------- 2 files changed, 10 insertions(+), 50 deletions(-) diff --git a/app/controllers/well_known/node_info_controller.rb b/app/controllers/well_known/node_info_controller.rb index 6633b137..c4031c69 100644 --- a/app/controllers/well_known/node_info_controller.rb +++ b/app/controllers/well_known/node_info_controller.rb @@ -8,7 +8,7 @@ class WellKnown::NodeInfoController < ApplicationController links: [ rel: "http://nodeinfo.diaspora.software/ns/schema/2.1", href: node_info_url - ] + ], } end @@ -21,12 +21,12 @@ class WellKnown::NodeInfoController < ApplicationController protocols: %i[], services: { inbound: inbound_services, - outbound: outbound_services + outbound: outbound_services, }, usage: usage_stats, # We don't implement this so we can always return true for now openRegistrations: true, - metadata: {} + metadata: {}, } end @@ -36,23 +36,19 @@ class WellKnown::NodeInfoController < ApplicationController { name: "Retrospring", version: Retrospring::Version.to_s, - repository: "https://github.com/Retrospring/retrospring" + repository: "https://github.com/Retrospring/retrospring", } end def usage_stats { users: { - total: User.count - } + total: User.count, + }, } end def inbound_services = [] - def outbound_services - { - "twitter" => APP_CONFIG.dig("sharing", "twitter", "enabled") - }.select { |_service, available| available }.keys - end + def outbound_services = [] end diff --git a/spec/controllers/well_known/node_info_controller_spec.rb b/spec/controllers/well_known/node_info_controller_spec.rb index ad6a8dce..54d871aa 100644 --- a/spec/controllers/well_known/node_info_controller_spec.rb +++ b/spec/controllers/well_known/node_info_controller_spec.rb @@ -13,9 +13,9 @@ describe WellKnown::NodeInfoController do "links" => [ { "rel" => "http://nodeinfo.diaspora.software/ns/schema/2.1", - "href" => "http://test.host/nodeinfo/2.1" + "href" => "http://test.host/nodeinfo/2.1", } - ] + ], }) end end @@ -44,47 +44,11 @@ describe WellKnown::NodeInfoController do expect(parsed["software"]).to eq({ "name" => "Retrospring", "version" => "2023.0102.1", - "repository" => "https://github.com/Retrospring/retrospring" + "repository" => "https://github.com/Retrospring/retrospring", }) end end - context "Twitter integration enabled" do - before do - stub_const("APP_CONFIG", { - "sharing" => { - "twitter" => { - "enabled" => true - } - } - }) - end - - it "includes Twitter in outbound services" do - subject - parsed = JSON.parse(response.body) - expect(parsed.dig("services", "outbound")).to include("twitter") - end - end - - context "Twitter integration disabled" do - before do - stub_const("APP_CONFIG", { - "sharing" => { - "twitter" => { - "enabled" => false - } - } - }) - end - - it "includes Twitter in outbound services" do - subject - parsed = JSON.parse(response.body) - expect(parsed.dig("services", "outbound")).to_not include("twitter") - end - end - context "site has users" do let(:num_users) { rand(10..50) }