See #872: rules and contact email settings
This commit is contained in:
parent
853cd833b5
commit
dce7a74f7e
|
@ -59,6 +59,29 @@ class InstanceTerms(types.StringPreference):
|
|||
field_kwargs = {"required": False}
|
||||
|
||||
|
||||
@global_preferences_registry.register
|
||||
class InstanceRules(types.StringPreference):
|
||||
show_in_api = True
|
||||
section = instance
|
||||
name = "rules"
|
||||
verbose_name = "Rules"
|
||||
default = ""
|
||||
help_text = "Rules/Code of Conduct (markdown allowed)."
|
||||
widget = widgets.Textarea
|
||||
field_kwargs = {"required": False}
|
||||
|
||||
|
||||
@global_preferences_registry.register
|
||||
class InstanceContactEmail(types.StringPreference):
|
||||
show_in_api = True
|
||||
section = instance
|
||||
name = "contact_email"
|
||||
verbose_name = "Contact email"
|
||||
default = ""
|
||||
help_text = "A contact email for visitors who need to contact an admin or moderator"
|
||||
field_kwargs = {"required": False}
|
||||
|
||||
|
||||
@global_preferences_registry.register
|
||||
class RavenDSN(types.StringPreference):
|
||||
show_in_api = True
|
||||
|
|
|
@ -42,6 +42,8 @@ def get():
|
|||
"private": all_preferences.get("instance__nodeinfo_private"),
|
||||
"shortDescription": all_preferences.get("instance__short_description"),
|
||||
"longDescription": all_preferences.get("instance__long_description"),
|
||||
"rules": all_preferences.get("instance__rules"),
|
||||
"contactEmail": all_preferences.get("instance__contact_email"),
|
||||
"terms": all_preferences.get("instance__terms"),
|
||||
"nodeName": all_preferences.get("instance__name"),
|
||||
"banner": federation_utils.full_url(banner.url) if banner else None,
|
||||
|
|
|
@ -40,6 +40,8 @@ def test_nodeinfo_dump(preferences, mocker, avatar):
|
|||
"shortDescription": preferences["instance__short_description"],
|
||||
"longDescription": preferences["instance__long_description"],
|
||||
"nodeName": preferences["instance__name"],
|
||||
"rules": preferences["instance__rules"],
|
||||
"contactEmail": preferences["instance__contact_email"],
|
||||
"terms": preferences["instance__terms"],
|
||||
"banner": federation_utils.full_url(preferences["instance__banner"].url),
|
||||
"library": {
|
||||
|
@ -109,6 +111,8 @@ def test_nodeinfo_dump_stats_disabled(preferences, mocker):
|
|||
"shortDescription": preferences["instance__short_description"],
|
||||
"longDescription": preferences["instance__long_description"],
|
||||
"nodeName": preferences["instance__name"],
|
||||
"rules": preferences["instance__rules"],
|
||||
"contactEmail": preferences["instance__contact_email"],
|
||||
"terms": preferences["instance__terms"],
|
||||
"banner": None,
|
||||
"library": {
|
||||
|
|
|
@ -95,6 +95,8 @@ export default {
|
|||
"instance__name",
|
||||
"instance__short_description",
|
||||
"instance__long_description",
|
||||
"instance__contact_email",
|
||||
"instance__rules",
|
||||
"instance__terms",
|
||||
"instance__banner",
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue