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: [
|
links: [
|
||||||
rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
|
rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
|
||||||
href: node_info_url
|
href: node_info_url
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ class WellKnown::NodeInfoController < ApplicationController
|
||||||
protocols: %i[],
|
protocols: %i[],
|
||||||
services: {
|
services: {
|
||||||
inbound: inbound_services,
|
inbound: inbound_services,
|
||||||
outbound: outbound_services
|
outbound: outbound_services,
|
||||||
},
|
},
|
||||||
usage: usage_stats,
|
usage: usage_stats,
|
||||||
# We don't implement this so we can always return true for now
|
# We don't implement this so we can always return true for now
|
||||||
openRegistrations: true,
|
openRegistrations: true,
|
||||||
metadata: {}
|
metadata: {},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -36,23 +36,19 @@ class WellKnown::NodeInfoController < ApplicationController
|
||||||
{
|
{
|
||||||
name: "Retrospring",
|
name: "Retrospring",
|
||||||
version: Retrospring::Version.to_s,
|
version: Retrospring::Version.to_s,
|
||||||
repository: "https://github.com/Retrospring/retrospring"
|
repository: "https://github.com/Retrospring/retrospring",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def usage_stats
|
def usage_stats
|
||||||
{
|
{
|
||||||
users: {
|
users: {
|
||||||
total: User.count
|
total: User.count,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def inbound_services = []
|
def inbound_services = []
|
||||||
|
|
||||||
def outbound_services
|
def outbound_services = []
|
||||||
{
|
|
||||||
"twitter" => APP_CONFIG.dig("sharing", "twitter", "enabled")
|
|
||||||
}.select { |_service, available| available }.keys
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,9 +13,9 @@ describe WellKnown::NodeInfoController do
|
||||||
"links" => [
|
"links" => [
|
||||||
{
|
{
|
||||||
"rel" => "http://nodeinfo.diaspora.software/ns/schema/2.1",
|
"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
|
||||||
end
|
end
|
||||||
|
@ -44,47 +44,11 @@ describe WellKnown::NodeInfoController do
|
||||||
expect(parsed["software"]).to eq({
|
expect(parsed["software"]).to eq({
|
||||||
"name" => "Retrospring",
|
"name" => "Retrospring",
|
||||||
"version" => "2023.0102.1",
|
"version" => "2023.0102.1",
|
||||||
"repository" => "https://github.com/Retrospring/retrospring"
|
"repository" => "https://github.com/Retrospring/retrospring",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
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
|
context "site has users" do
|
||||||
let(:num_users) { rand(10..50) }
|
let(:num_users) { rand(10..50) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue