Add enable_emoji_reaction setting
This commit is contained in:
parent
181cff6810
commit
2be77df3aa
9 changed files with 36 additions and 10 deletions
|
@ -364,13 +364,16 @@ class Account < ApplicationRecord
|
|||
end
|
||||
|
||||
def emoji_reaction_policy
|
||||
return settings['emoji_reaction_policy']&.to_sym || :allow if settings.present?
|
||||
return settings['emoji_reaction_policy']&.to_sym || :allow if settings.present? && user.nil?
|
||||
return :allow if user.nil?
|
||||
return :block_and_hide if local? && !Setting.enable_emoji_reaction
|
||||
|
||||
user.settings&.[]('emoji_reaction_policy')&.to_sym
|
||||
user.setting_emoji_reaction_policy&.to_sym
|
||||
end
|
||||
|
||||
def show_emoji_reaction?(account)
|
||||
return false unless Setting.enable_emoji_reaction
|
||||
|
||||
case emoji_reaction_policy
|
||||
when :block_and_hide
|
||||
false
|
||||
|
@ -390,12 +393,7 @@ class Account < ApplicationRecord
|
|||
def allow_emoji_reaction?(account)
|
||||
return false if account.nil?
|
||||
|
||||
case emoji_reaction_policy
|
||||
when :block
|
||||
false
|
||||
else
|
||||
show_emoji_reaction?(account)
|
||||
end
|
||||
show_emoji_reaction?(account)
|
||||
end
|
||||
|
||||
def public_settings
|
||||
|
@ -408,12 +406,28 @@ class Account < ApplicationRecord
|
|||
'hide_followers_count' => hide_followers_count?,
|
||||
'translatable_private' => translatable_private?,
|
||||
'link_preview' => link_preview?,
|
||||
'emoji_reaction_policy' => user&.setting_emoji_reaction_policy,
|
||||
}
|
||||
if Setting.enable_emoji_reaction
|
||||
config = config.merge({
|
||||
'emoji_reaction_policy' => emoji_reaction_policy,
|
||||
})
|
||||
end
|
||||
config = config.merge(settings) if settings.present?
|
||||
config
|
||||
end
|
||||
|
||||
def public_settings_for_local
|
||||
config = public_settings
|
||||
|
||||
unless Setting.enable_emoji_reaction
|
||||
config = config.merge({
|
||||
'emoji_reaction_policy' => :block_and_hide,
|
||||
})
|
||||
end
|
||||
|
||||
config
|
||||
end
|
||||
|
||||
def previous_strikes_count
|
||||
strikes.where(overruled_at: nil).count
|
||||
end
|
||||
|
|
|
@ -43,6 +43,7 @@ class Form::AdminSettings
|
|||
sensitive_words_for_full
|
||||
authorized_fetch
|
||||
receive_other_servers_emoji_reaction
|
||||
enable_emoji_reaction
|
||||
).freeze
|
||||
|
||||
INTEGER_KEYS = %i(
|
||||
|
@ -67,6 +68,7 @@ class Form::AdminSettings
|
|||
hide_local_users_for_anonymous
|
||||
authorized_fetch
|
||||
receive_other_servers_emoji_reaction
|
||||
enable_emoji_reaction
|
||||
).freeze
|
||||
|
||||
UPLOAD_KEYS = %i(
|
||||
|
|
|
@ -168,6 +168,6 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def other_settings
|
||||
object.suspended? ? {} : object.public_settings
|
||||
object.suspended? ? {} : object.public_settings_for_local
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,6 +29,11 @@
|
|||
.fields-group
|
||||
= f.input :noindex, as: :boolean, wrapper: :with_label, label: t('admin.settings.default_noindex.title'), hint: t('admin.settings.default_noindex.desc_html')
|
||||
|
||||
%h4= t('admin.settings.discovery.emoji_reactions')
|
||||
|
||||
.fields-group
|
||||
= f.input :enable_emoji_reaction, as: :boolean, wrapper: :with_label, kmyblue: true, hint: false
|
||||
|
||||
.fields-group
|
||||
= f.input :receive_other_servers_emoji_reaction, as: :boolean, wrapper: :with_label, kmyblue: true
|
||||
|
||||
|
|
|
@ -804,6 +804,7 @@ en:
|
|||
desc_html: Affects all users who have not changed this setting themselves
|
||||
title: Opt users out of search engine indexing by default
|
||||
discovery:
|
||||
emoji_reactions: Stamp
|
||||
follow_recommendations: Follow recommendations
|
||||
preamble: Surfacing interesting content is instrumental in onboarding new users who may not know anyone Mastodon. Control how various discovery features work on your server.
|
||||
profile_directory: Profile directory
|
||||
|
|
|
@ -800,6 +800,7 @@ ja:
|
|||
desc_html: この設定を自分で変更していない全ユーザーに影響します
|
||||
title: デフォルトで検索エンジンによるインデックスを拒否する
|
||||
discovery:
|
||||
emoji_reactions: スタンプ
|
||||
follow_recommendations: おすすめフォロー
|
||||
preamble: Mastodon を知らないユーザーを取り込むには、興味深いコンテンツを浮上させることが重要です。サーバー上で様々なディスカバリー機能がどのように機能するかを制御します。
|
||||
profile_directory: ディレクトリ
|
||||
|
|
|
@ -314,6 +314,7 @@ en:
|
|||
closed_registrations_message: Custom message when sign-ups are not available
|
||||
content_cache_retention_period: Content cache retention period
|
||||
custom_css: Custom CSS
|
||||
enable_emoji_reaction: Enable stamp function
|
||||
mascot: Custom mascot (legacy)
|
||||
media_cache_retention_period: Media cache retention period
|
||||
peers_api_enabled: Publish list of discovered servers in the API
|
||||
|
|
|
@ -325,6 +325,7 @@ ja:
|
|||
closed_registrations_message: アカウント作成を停止している時のカスタムメッセージ
|
||||
content_cache_retention_period: コンテンツキャッシュの保持期間
|
||||
custom_css: カスタムCSS
|
||||
enable_emoji_reaction: スタンプ機能を有効にする
|
||||
mascot: カスタムマスコット(レガシー)
|
||||
media_cache_retention_period: メディアキャッシュの保持期間
|
||||
peers_api_enabled: 発見したサーバーのリストをAPIで公開する
|
||||
|
|
|
@ -39,6 +39,7 @@ defaults: &defaults
|
|||
backups_retention_period: 7
|
||||
captcha_enabled: false
|
||||
receive_other_servers_emoji_reaction: false
|
||||
enable_emoji_reaction: true
|
||||
|
||||
development:
|
||||
<<: *defaults
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue