mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Add setting for status page URL (#23390)
This commit is contained in:
parent
01584f03e8
commit
8f590b0a21
@ -3,7 +3,7 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { domain, version, source_url, profile_directory as profileDirectory } from 'mastodon/initial_state';
|
import { domain, version, source_url, statusPageUrl, profile_directory as profileDirectory } from 'mastodon/initial_state';
|
||||||
import { logOut } from 'mastodon/utils/log_out';
|
import { logOut } from 'mastodon/utils/log_out';
|
||||||
import { openModal } from 'mastodon/actions/modal';
|
import { openModal } from 'mastodon/actions/modal';
|
||||||
import { PERMISSION_INVITE_USERS } from 'mastodon/permissions';
|
import { PERMISSION_INVITE_USERS } from 'mastodon/permissions';
|
||||||
@ -59,21 +59,27 @@ class LinkFooter extends React.PureComponent {
|
|||||||
<p>
|
<p>
|
||||||
<strong>{domain}</strong>:
|
<strong>{domain}</strong>:
|
||||||
{' '}
|
{' '}
|
||||||
<Link key='about' to='/about'><FormattedMessage id='footer.about' defaultMessage='About' /></Link>
|
<Link to='/about'><FormattedMessage id='footer.about' defaultMessage='About' /></Link>
|
||||||
|
{statusPageUrl && (
|
||||||
|
<>
|
||||||
|
{DividingCircle}
|
||||||
|
<a href={statusPageUrl} target='_blank' rel='noopener'><FormattedMessage id='footer.status' defaultMessage='Status' /></a>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{canInvite && (
|
{canInvite && (
|
||||||
<>
|
<>
|
||||||
{DividingCircle}
|
{DividingCircle}
|
||||||
<a key='invites' href='/invites' target='_blank'><FormattedMessage id='footer.invite' defaultMessage='Invite people' /></a>
|
<a href='/invites' target='_blank'><FormattedMessage id='footer.invite' defaultMessage='Invite people' /></a>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{canProfileDirectory && (
|
{canProfileDirectory && (
|
||||||
<>
|
<>
|
||||||
{DividingCircle}
|
{DividingCircle}
|
||||||
<Link key='directory' to='/directory'><FormattedMessage id='footer.directory' defaultMessage='Profiles directory' /></Link>
|
<Link to='/directory'><FormattedMessage id='footer.directory' defaultMessage='Profiles directory' /></Link>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{DividingCircle}
|
{DividingCircle}
|
||||||
<Link key='privacy-policy' to='/privacy-policy'><FormattedMessage id='footer.privacy_policy' defaultMessage='Privacy policy' /></Link>
|
<Link to='/privacy-policy'><FormattedMessage id='footer.privacy_policy' defaultMessage='Privacy policy' /></Link>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -134,5 +134,6 @@ export const usePendingItems = getMeta('use_pending_items');
|
|||||||
export const version = getMeta('version');
|
export const version = getMeta('version');
|
||||||
export const translationEnabled = getMeta('translation_enabled');
|
export const translationEnabled = getMeta('translation_enabled');
|
||||||
export const languages = initialState?.languages;
|
export const languages = initialState?.languages;
|
||||||
|
export const statusPageUrl = getMeta('status_page_url');
|
||||||
|
|
||||||
export default initialState;
|
export default initialState;
|
||||||
|
@ -32,6 +32,7 @@ class Form::AdminSettings
|
|||||||
media_cache_retention_period
|
media_cache_retention_period
|
||||||
content_cache_retention_period
|
content_cache_retention_period
|
||||||
backups_retention_period
|
backups_retention_period
|
||||||
|
status_page_url
|
||||||
).freeze
|
).freeze
|
||||||
|
|
||||||
INTEGER_KEYS = %i(
|
INTEGER_KEYS = %i(
|
||||||
@ -68,6 +69,7 @@ class Form::AdminSettings
|
|||||||
validates :show_domain_blocks_rationale, inclusion: { in: %w(disabled users all) }, if: -> { defined?(@show_domain_blocks_rationale) }
|
validates :show_domain_blocks_rationale, inclusion: { in: %w(disabled users all) }, if: -> { defined?(@show_domain_blocks_rationale) }
|
||||||
validates :media_cache_retention_period, :content_cache_retention_period, :backups_retention_period, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@media_cache_retention_period) || defined?(@content_cache_retention_period) || defined?(@backups_retention_period) }
|
validates :media_cache_retention_period, :content_cache_retention_period, :backups_retention_period, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@media_cache_retention_period) || defined?(@content_cache_retention_period) || defined?(@backups_retention_period) }
|
||||||
validates :site_short_description, length: { maximum: 200 }, if: -> { defined?(@site_short_description) }
|
validates :site_short_description, length: { maximum: 200 }, if: -> { defined?(@site_short_description) }
|
||||||
|
validates :status_page_url, url: true
|
||||||
validate :validate_site_uploads
|
validate :validate_site_uploads
|
||||||
|
|
||||||
KEYS.each do |key|
|
KEYS.each do |key|
|
||||||
|
@ -38,6 +38,10 @@ class InstancePresenter < ActiveModelSerializers::Model
|
|||||||
Setting.site_terms
|
Setting.site_terms
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def status_page_url
|
||||||
|
Setting.status_page_url
|
||||||
|
end
|
||||||
|
|
||||||
def domain
|
def domain
|
||||||
Rails.configuration.x.local_domain
|
Rails.configuration.x.local_domain
|
||||||
end
|
end
|
||||||
|
@ -33,6 +33,7 @@ class InitialStateSerializer < ActiveModel::Serializer
|
|||||||
single_user_mode: Rails.configuration.x.single_user_mode,
|
single_user_mode: Rails.configuration.x.single_user_mode,
|
||||||
translation_enabled: TranslationService.configured?,
|
translation_enabled: TranslationService.configured?,
|
||||||
trends_as_landing_page: Setting.trends_as_landing_page,
|
trends_as_landing_page: Setting.trends_as_landing_page,
|
||||||
|
status_page_url: Setting.status_page_url,
|
||||||
}
|
}
|
||||||
|
|
||||||
if object.current_account
|
if object.current_account
|
||||||
|
@ -45,6 +45,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||||||
{
|
{
|
||||||
urls: {
|
urls: {
|
||||||
streaming: Rails.configuration.x.streaming_api_base_url,
|
streaming: Rails.configuration.x.streaming_api_base_url,
|
||||||
|
status: object.status_page_url,
|
||||||
},
|
},
|
||||||
|
|
||||||
accounts: {
|
accounts: {
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
.fields-row__column.fields-row__column-6.fields-group
|
.fields-row__column.fields-row__column-6.fields-group
|
||||||
= f.input :show_domain_blocks_rationale, wrapper: :with_label, collection: %i(disabled users all), label_method: lambda { |value| t("admin.settings.domain_blocks.#{value}") }, include_blank: false, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li'
|
= f.input :show_domain_blocks_rationale, wrapper: :with_label, collection: %i(disabled users all), label_method: lambda { |value| t("admin.settings.domain_blocks.#{value}") }, include_blank: false, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li'
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= f.input :status_page_url, wrapper: :with_block_label, input_html: { placeholder: "https://status.#{Rails.configuration.x.local_domain}" }
|
||||||
|
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :site_terms, wrapper: :with_block_label, as: :text, input_html: { rows: 8 }
|
= f.input :site_terms, wrapper: :with_block_label, as: :text, input_html: { rows: 8 }
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@ en:
|
|||||||
site_short_description: A short description to help uniquely identify your server. Who is running it, who is it for?
|
site_short_description: A short description to help uniquely identify your server. Who is running it, who is it for?
|
||||||
site_terms: Use your own privacy policy or leave blank to use the default. Can be structured with Markdown syntax.
|
site_terms: Use your own privacy policy or leave blank to use the default. Can be structured with Markdown syntax.
|
||||||
site_title: How people may refer to your server besides its domain name.
|
site_title: How people may refer to your server besides its domain name.
|
||||||
|
status_page_url: URL of a page where people can see the status of this server during an outage
|
||||||
theme: Theme that logged out visitors and new users see.
|
theme: Theme that logged out visitors and new users see.
|
||||||
thumbnail: A roughly 2:1 image displayed alongside your server information.
|
thumbnail: A roughly 2:1 image displayed alongside your server information.
|
||||||
timeline_preview: Logged out visitors will be able to browse the most recent public posts available on the server.
|
timeline_preview: Logged out visitors will be able to browse the most recent public posts available on the server.
|
||||||
@ -252,6 +253,7 @@ en:
|
|||||||
site_short_description: Server description
|
site_short_description: Server description
|
||||||
site_terms: Privacy Policy
|
site_terms: Privacy Policy
|
||||||
site_title: Server name
|
site_title: Server name
|
||||||
|
status_page_url: Status page URL
|
||||||
theme: Default theme
|
theme: Default theme
|
||||||
thumbnail: Server thumbnail
|
thumbnail: Server thumbnail
|
||||||
timeline_preview: Allow unauthenticated access to public timelines
|
timeline_preview: Allow unauthenticated access to public timelines
|
||||||
|
Loading…
Reference in New Issue
Block a user