Unverified Commit e1777067 authored by Benjamin Neff's avatar Benjamin Neff Committed by Dennis Schubert

Add admin account username to NodeInfo metadata

Fixes #7421

closes #7447
parent 7934c1e9
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment