Add publish_button_text site setting

This commit is contained in:
Effy Elden 2022-11-16 21:54:41 +11:00
parent a1738f8991
commit aeed3a9a1b
No known key found for this signature in database
GPG key ID: 532C5E50BF4F86EE
7 changed files with 13 additions and 2 deletions

View file

@ -21,6 +21,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import { length } from 'stringz'; import { length } from 'stringz';
import { countableText } from '../util/counter'; import { countableText } from '../util/counter';
import Icon from 'mastodon/components/icon'; import Icon from 'mastodon/components/icon';
import { publish_button_text } from 'mastodon/initial_state';
const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d'; const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d';
@ -211,13 +212,14 @@ class ComposeForm extends ImmutablePureComponent {
const disabled = this.props.isSubmitting; const disabled = this.props.isSubmitting;
let publishText = ''; let publishText = '';
let publishButtonText = publish_button_text || intl.formatMessage(messages.publish);
if (this.props.isEditing) { if (this.props.isEditing) {
publishText = intl.formatMessage(messages.saveChanges); publishText = intl.formatMessage(messages.saveChanges);
} else if (this.props.privacy === 'private' || this.props.privacy === 'direct') { } else if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
publishText = <span className='compose-form__publish-private'><Icon id='lock' /> {intl.formatMessage(messages.publish)}</span>; publishText = <span className='compose-form__publish-private'><Icon id='lock' /> {publishButtonText}</span>;
} else { } else {
publishText = this.props.privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish); publishText = this.props.privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: publishButtonText }) : publishButtonText;
} }
return ( return (

View file

@ -80,6 +80,7 @@
* @property {boolean=} use_pending_items * @property {boolean=} use_pending_items
* @property {string} version * @property {string} version
* @property {boolean} translation_enabled * @property {boolean} translation_enabled
* @property {string} publish_button_text
*/ */
/** /**
@ -132,5 +133,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 publish_button_text = getMeta('publish_button_text');
export default initialState; export default initialState;

View file

@ -31,6 +31,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
publish_button_text
).freeze ).freeze
INTEGER_KEYS = %i( INTEGER_KEYS = %i(

View file

@ -32,6 +32,7 @@ class InitialStateSerializer < ActiveModel::Serializer
activity_api_enabled: Setting.activity_api_enabled, activity_api_enabled: Setting.activity_api_enabled,
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?,
publish_button_text: Setting.publish_button_text,
} }
if object.current_account if object.current_account

View file

@ -30,5 +30,8 @@
= fa_icon 'trash fw' = fa_icon 'trash fw'
= t('admin.site_uploads.delete') = t('admin.site_uploads.delete')
.fields-group
= f.input :publish_button_text, wrapper: :with_block_label
.actions .actions
= f.button :button, t('generic.save_changes'), type: :submit = f.button :button, t('generic.save_changes'), type: :submit

View file

@ -82,6 +82,7 @@ en:
mascot: Overrides the illustration in the advanced web interface. mascot: Overrides the illustration in the advanced web interface.
media_cache_retention_period: Downloaded media files will be deleted after the specified number of days when set to a positive value, and re-downloaded on demand. media_cache_retention_period: Downloaded media files will be deleted after the specified number of days when set to a positive value, and re-downloaded on demand.
profile_directory: The profile directory lists all users who have opted-in to be discoverable. profile_directory: The profile directory lists all users who have opted-in to be discoverable.
publish_button_text: Overrides the text of the publish button.
require_invite_text: When sign-ups require manual approval, make the “Why do you want to join?” text input mandatory rather than optional require_invite_text: When sign-ups require manual approval, make the “Why do you want to join?” text input mandatory rather than optional
site_contact_email: How people can reach you for legal or support inquiries. site_contact_email: How people can reach you for legal or support inquiries.
site_contact_username: How people can reach you on Mastodon. site_contact_username: How people can reach you on Mastodon.

View file

@ -70,6 +70,7 @@ defaults: &defaults
show_domain_blocks_rationale: 'disabled' show_domain_blocks_rationale: 'disabled'
require_invite_text: false require_invite_text: false
backups_retention_period: 7 backups_retention_period: 7
publish_button_text: ''
development: development:
<<: *defaults <<: *defaults