Add admin account username to NodeInfo metadata
Fixes #7421 closes #7447
This commit is contained in:
parent
7934c1e969
commit
e177706769
3 changed files with 22 additions and 5 deletions
|
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
* Add support for Nodeinfo 2.0 [#7447](https://github.com/diaspora/diaspora/pull/7447)
|
||||||
|
|
||||||
# 0.6.5.0
|
# 0.6.5.0
|
||||||
|
|
||||||
## Refactor
|
## Refactor
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ class NodeInfoPresenter
|
||||||
doc.open_registrations = open_registrations?
|
doc.open_registrations = open_registrations?
|
||||||
doc.metadata["nodeName"] = name
|
doc.metadata["nodeName"] = name
|
||||||
doc.metadata["xmppChat"] = chat_enabled?
|
doc.metadata["xmppChat"] = chat_enabled?
|
||||||
|
doc.metadata["adminAccount"] = admin_account
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_static_data(doc)
|
def add_static_data(doc)
|
||||||
|
|
@ -70,6 +71,10 @@ class NodeInfoPresenter
|
||||||
AppConfig.chat.enabled?
|
AppConfig.chat.enabled?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def admin_account
|
||||||
|
AppConfig.admins.account if AppConfig.admins.account?
|
||||||
|
end
|
||||||
|
|
||||||
def available_services
|
def available_services
|
||||||
Configuration::KNOWN_SERVICES.select {|service|
|
Configuration::KNOWN_SERVICES.select {|service|
|
||||||
AppConfig.show_service?(service, nil)
|
AppConfig.show_service?(service, nil)
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,16 @@ describe NodeInfoPresenter do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when admin account is set" do
|
||||||
|
before do
|
||||||
|
AppConfig.admins.account = "podmin"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "adds the admin account username" do
|
||||||
|
expect(hash).to include "metadata" => include("adminAccount" => "podmin")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "version 2.0" do
|
context "version 2.0" do
|
||||||
it "provides generic pod data in json" do
|
it "provides generic pod data in json" do
|
||||||
expect(NodeInfoPresenter.new("2.0").as_json.as_json).to eq(
|
expect(NodeInfoPresenter.new("2.0").as_json.as_json).to eq(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue