well_known/node_info: remove twitter as outbound service
This commit is contained in:
parent
484badb555
commit
065d35c288
|
@ -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
|
||||
|
|
|
@ -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) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue