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