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
|
||||
|
||||
* Add support for Nodeinfo 2.0 [#7447](https://github.com/diaspora/diaspora/pull/7447)
|
||||
|
||||
# 0.6.5.0
|
||||
|
||||
## Refactor
|
||||
|
|
|
|||
|
|
@ -17,11 +17,12 @@ class NodeInfoPresenter
|
|||
end
|
||||
|
||||
def add_configuration(doc)
|
||||
doc.software.version = version
|
||||
doc.services.outbound = available_services
|
||||
doc.open_registrations = open_registrations?
|
||||
doc.metadata["nodeName"] = name
|
||||
doc.metadata["xmppChat"] = chat_enabled?
|
||||
doc.software.version = version
|
||||
doc.services.outbound = available_services
|
||||
doc.open_registrations = open_registrations?
|
||||
doc.metadata["nodeName"] = name
|
||||
doc.metadata["xmppChat"] = chat_enabled?
|
||||
doc.metadata["adminAccount"] = admin_account
|
||||
end
|
||||
|
||||
def add_static_data(doc)
|
||||
|
|
@ -70,6 +71,10 @@ class NodeInfoPresenter
|
|||
AppConfig.chat.enabled?
|
||||
end
|
||||
|
||||
def admin_account
|
||||
AppConfig.admins.account if AppConfig.admins.account?
|
||||
end
|
||||
|
||||
def available_services
|
||||
Configuration::KNOWN_SERVICES.select {|service|
|
||||
AppConfig.show_service?(service, nil)
|
||||
|
|
|
|||
|
|
@ -129,6 +129,16 @@ describe NodeInfoPresenter do
|
|||
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
|
||||
it "provides generic pod data in json" do
|
||||
expect(NodeInfoPresenter.new("2.0").as_json.as_json).to eq(
|
||||
|
|
|
|||
Loading…
Reference in a new issue