Add admin account username to NodeInfo metadata

Fixes #7421

closes #7447
This commit is contained in:
Benjamin Neff 2017-05-10 03:34:41 +02:00 committed by Dennis Schubert
parent 7934c1e969
commit e177706769
No known key found for this signature in database
GPG key ID: 5A0304BEA7966D7E
3 changed files with 22 additions and 5 deletions

View file

@ -13,6 +13,8 @@
## Features
* Add support for Nodeinfo 2.0 [#7447](https://github.com/diaspora/diaspora/pull/7447)
# 0.6.5.0
## Refactor

View file

@ -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)

View file

@ -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(