Add translatable_private setting
This commit is contained in:
parent
05ae3c1948
commit
3cf08a8f4b
8 changed files with 25 additions and 2 deletions
|
@ -241,7 +241,12 @@ class StatusContent extends PureComponent {
|
||||||
const renderReadMore = this.props.onClick && status.get('collapsed');
|
const renderReadMore = this.props.onClick && status.get('collapsed');
|
||||||
const contentLocale = intl.locale.replace(/[_-].*/, '');
|
const contentLocale = intl.locale.replace(/[_-].*/, '');
|
||||||
const targetLanguages = this.props.languages?.get(status.get('language') || 'und');
|
const targetLanguages = this.props.languages?.get(status.get('language') || 'und');
|
||||||
const renderTranslate = this.props.onTranslate && this.context.identity.signedIn && ['public', 'unlisted'].includes(status.get('visibility')) && status.get('search_index').trim().length > 0 && status.get('language') && targetLanguages?.includes(contentLocale);
|
const renderTranslate = this.props.onTranslate &&
|
||||||
|
this.context.identity.signedIn &&
|
||||||
|
(['public', 'unlisted'].includes(status.get('visibility')) || status.getIn(['account', 'other_settings', 'translatable_private'])) &&
|
||||||
|
status.get('search_index').trim().length > 0 &&
|
||||||
|
status.get('language') &&
|
||||||
|
targetLanguages?.includes(contentLocale);
|
||||||
|
|
||||||
const content = { __html: statusContent ?? getStatusContent(status) };
|
const content = { __html: statusContent ?? getStatusContent(status) };
|
||||||
const spoilerContent = { __html: status.getIn(['translation', 'spoilerHtml']) || status.get('spoilerHtml') };
|
const spoilerContent = { __html: status.getIn(['translation', 'spoilerHtml']) || status.get('spoilerHtml') };
|
||||||
|
|
|
@ -319,6 +319,10 @@ class Account < ApplicationRecord
|
||||||
user&.setting_noai || (settings.present? && settings['noai']) || false
|
user&.setting_noai || (settings.present? && settings['noai']) || false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def translatable_private?
|
||||||
|
user&.setting_translatable_private || (settings.present? && settings['translatable_private']) || false
|
||||||
|
end
|
||||||
|
|
||||||
def public_statuses_count
|
def public_statuses_count
|
||||||
hide_statuses_count? ? 0 : statuses_count
|
hide_statuses_count? ? 0 : statuses_count
|
||||||
end
|
end
|
||||||
|
@ -387,6 +391,7 @@ class Account < ApplicationRecord
|
||||||
'emoji_reaction_must_following' => emoji_reactions_must_following?,
|
'emoji_reaction_must_following' => emoji_reactions_must_following?,
|
||||||
'emoji_reaction_must_follower' => emoji_reactions_must_follower?,
|
'emoji_reaction_must_follower' => emoji_reactions_must_follower?,
|
||||||
'emoji_reaction_deny_from_all' => emoji_reactions_deny_from_all?,
|
'emoji_reaction_deny_from_all' => emoji_reactions_deny_from_all?,
|
||||||
|
'translatable_private' => translatable_private?,
|
||||||
}
|
}
|
||||||
config = config.merge(settings) if settings.present?
|
config = config.merge(settings) if settings.present?
|
||||||
config
|
config
|
||||||
|
|
|
@ -99,6 +99,10 @@ module HasUserSettings
|
||||||
settings['noai']
|
settings['noai']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def setting_translatable_private
|
||||||
|
settings['translatable_private']
|
||||||
|
end
|
||||||
|
|
||||||
def setting_hide_statuses_count
|
def setting_hide_statuses_count
|
||||||
settings['hide_statuses_count']
|
settings['hide_statuses_count']
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,6 +12,7 @@ class UserSettings
|
||||||
setting :theme, default: -> { ::Setting.theme }
|
setting :theme, default: -> { ::Setting.theme }
|
||||||
setting :noindex, default: -> { ::Setting.noindex }
|
setting :noindex, default: -> { ::Setting.noindex }
|
||||||
setting :noai, default: true
|
setting :noai, default: true
|
||||||
|
setting :translatable_private, default: false
|
||||||
setting :bio_markdown, default: false
|
setting :bio_markdown, default: false
|
||||||
setting :discoverable_local, default: false
|
setting :discoverable_local, default: false
|
||||||
setting :hide_statuses_count, default: false
|
setting :hide_statuses_count, default: false
|
||||||
|
|
|
@ -30,7 +30,7 @@ class TranslateStatusService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def permitted?
|
def permitted?
|
||||||
return false unless @status.distributable? && TranslationService.configured?
|
return false unless (@status.distributable? || @status.account.translatable_private?) && TranslationService.configured?
|
||||||
|
|
||||||
languages[@status.language]&.include?(@target_language)
|
languages[@status.language]&.include?(@target_language)
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,12 @@
|
||||||
.fields-group
|
.fields-group
|
||||||
= ff.input :aggregate_reblogs, wrapper: :with_label, recommended: true, label: I18n.t('simple_form.labels.defaults.setting_aggregate_reblogs'), hint: I18n.t('simple_form.hints.defaults.setting_aggregate_reblogs')
|
= ff.input :aggregate_reblogs, wrapper: :with_label, recommended: true, label: I18n.t('simple_form.labels.defaults.setting_aggregate_reblogs'), hint: I18n.t('simple_form.hints.defaults.setting_aggregate_reblogs')
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= ff.input :noai, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_noai'), hint: I18n.t('simple_form.hints.defaults.setting_noai')
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= ff.input :translatable_private, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_translatable_private')
|
||||||
|
|
||||||
%h4= t 'preferences.posting_defaults'
|
%h4= t 'preferences.posting_defaults'
|
||||||
|
|
||||||
.fields-row
|
.fields-row
|
||||||
|
|
|
@ -253,6 +253,7 @@ en:
|
||||||
setting_stop_emoji_reaction_streaming: Disable stamp streamings
|
setting_stop_emoji_reaction_streaming: Disable stamp streamings
|
||||||
setting_system_font_ui: Use system's default font
|
setting_system_font_ui: Use system's default font
|
||||||
setting_theme: Site theme
|
setting_theme: Site theme
|
||||||
|
setting_translatable_private: Allow other users translation of your private posts
|
||||||
setting_trends: Show today's trends
|
setting_trends: Show today's trends
|
||||||
setting_unfollow_modal: Show confirmation dialog before unfollowing someone
|
setting_unfollow_modal: Show confirmation dialog before unfollowing someone
|
||||||
setting_unsafe_limited_distribution: Send limit posts with unsafe way to other servers
|
setting_unsafe_limited_distribution: Send limit posts with unsafe way to other servers
|
||||||
|
|
|
@ -263,6 +263,7 @@ ja:
|
||||||
setting_stop_emoji_reaction_streaming: スタンプのストリーミングを停止する
|
setting_stop_emoji_reaction_streaming: スタンプのストリーミングを停止する
|
||||||
setting_system_font_ui: システムのデフォルトフォントを使う
|
setting_system_font_ui: システムのデフォルトフォントを使う
|
||||||
setting_theme: サイトテーマ
|
setting_theme: サイトテーマ
|
||||||
|
setting_translatable_private: 非公開投稿の翻訳を許可する
|
||||||
setting_trends: 本日のトレンドタグを表示する
|
setting_trends: 本日のトレンドタグを表示する
|
||||||
setting_unfollow_modal: フォローを解除する前に確認ダイアログを表示する
|
setting_unfollow_modal: フォローを解除する前に確認ダイアログを表示する
|
||||||
setting_unsafe_limited_distribution: 安全でない方法で限定投稿を他サーバーに配信する (非推奨)
|
setting_unsafe_limited_distribution: 安全でない方法で限定投稿を他サーバーに配信する (非推奨)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue