Remove emoji reaction from fedibird_capabilities and setting pages when disabled
This commit is contained in:
parent
04418d5b01
commit
35c2bb9f44
9 changed files with 20 additions and 40 deletions
|
@ -42,6 +42,7 @@ class Api::V1::Statuses::EmojiReactionsController < Api::BaseController
|
|||
def create_private(emoji)
|
||||
count = EmojiReaction.where(account: current_account, status: @status).count
|
||||
raise Mastodon::ValidationError, I18n.t('reactions.errors.limit_reached') if count >= EmojiReaction::EMOJI_REACTION_PER_ACCOUNT_LIMIT
|
||||
raise Mastodon::ValidationError, I18n.t('reactions.errors.disabled') unless Setting.enable_emoji_reaction
|
||||
|
||||
EmojiReactService.new.call(current_account, @status, emoji)
|
||||
render json: @status, serializer: REST::StatusSerializer
|
||||
|
|
|
@ -11,7 +11,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
|
||||
attributes :domain, :title, :version, :source_url, :description,
|
||||
:usage, :thumbnail, :languages, :configuration,
|
||||
:registrations, :fedibird_capabilities, :kmyblue_capabilities
|
||||
:registrations, :fedibird_capabilities
|
||||
|
||||
has_one :contact, serializer: ContactSerializer
|
||||
has_many :rules, serializer: REST::RuleSerializer
|
||||
|
@ -108,7 +108,6 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
# for third party apps
|
||||
def fedibird_capabilities
|
||||
capabilities = [
|
||||
:emoji_reaction,
|
||||
:kmyblue_visibility_public_unlisted,
|
||||
:enable_wide_emoji,
|
||||
:enable_wide_emoji_reaction,
|
||||
|
@ -126,24 +125,11 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
]
|
||||
|
||||
capabilities << :profile_search unless Chewy.enabled?
|
||||
capabilities << :emoji_reaction if Setting.enable_emoji_reaction
|
||||
|
||||
capabilities
|
||||
end
|
||||
|
||||
def kmyblue_capabilities
|
||||
%i(
|
||||
visibility_public_unlisted
|
||||
searchability
|
||||
markdown
|
||||
reaction_deck
|
||||
visibility_login
|
||||
limited_scope
|
||||
antenna
|
||||
bookmark_category
|
||||
status_expiration
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def registrations_enabled?
|
||||
|
|
|
@ -6,7 +6,7 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
|
|||
attributes :uri, :title, :short_description, :description, :email,
|
||||
:version, :urls, :stats, :thumbnail,
|
||||
:languages, :registrations, :approval_required, :invites_enabled,
|
||||
:configuration, :fedibird_capabilities, :kmyblue_capabilities
|
||||
:configuration, :fedibird_capabilities
|
||||
|
||||
has_one :contact_account, serializer: REST::AccountSerializer
|
||||
|
||||
|
@ -117,7 +117,6 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
|
|||
# for third party apps
|
||||
def fedibird_capabilities
|
||||
capabilities = [
|
||||
:emoji_reaction,
|
||||
:kmyblue_visibility_public_unlisted,
|
||||
:enable_wide_emoji,
|
||||
:enable_wide_emoji_reaction,
|
||||
|
@ -135,24 +134,11 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
|
|||
]
|
||||
|
||||
capabilities << :profile_search unless Chewy.enabled?
|
||||
capabilities << :emoji_reaction if Setting.enable_emoji_reaction
|
||||
|
||||
capabilities
|
||||
end
|
||||
|
||||
def kmyblue_capabilities
|
||||
%i(
|
||||
visibility_public_unlisted
|
||||
searchability
|
||||
markdown
|
||||
reaction_deck
|
||||
visibility_login
|
||||
limited_scope
|
||||
antenna
|
||||
bookmark_category
|
||||
status_expiration
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def instance_presenter
|
||||
|
|
|
@ -39,8 +39,9 @@
|
|||
|
||||
.fields-group
|
||||
= ff.input :'web.hide_recent_emojis', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_recent_emojis'), hint: false
|
||||
= ff.input :'web.enable_emoji_reaction', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_enable_emoji_reaction'), hint: I18n.t('simple_form.hints.defaults.setting_enable_emoji_reaction')
|
||||
= ff.input :'web.show_emoji_reaction_on_timeline', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_emoji_reaction_on_timeline')
|
||||
- if Setting.enable_emoji_reaction
|
||||
= ff.input :'web.enable_emoji_reaction', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_enable_emoji_reaction'), hint: I18n.t('simple_form.hints.defaults.setting_enable_emoji_reaction')
|
||||
= ff.input :'web.show_emoji_reaction_on_timeline', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_emoji_reaction_on_timeline')
|
||||
|
||||
.fields-group
|
||||
= ff.input :'web.bookmark_category_needed', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_bookmark_category_needed'), hint: I18n.t('simple_form.hints.defaults.setting_bookmark_category_needed')
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
= ff.input :'interactions.must_be_following', wrapper: :with_label, label: I18n.t('simple_form.labels.interactions.must_be_following')
|
||||
= ff.input :'interactions.must_be_following_dm', wrapper: :with_label, label: I18n.t('simple_form.labels.interactions.must_be_following_dm')
|
||||
|
||||
= f.simple_fields_for :settings, current_user.settings do |ff|
|
||||
.fields-group
|
||||
= ff.input :stop_emoji_reaction_streaming, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_stop_emoji_reaction_streaming'), hint: I18n.t('simple_form.hints.defaults.setting_stop_emoji_reaction_streaming')
|
||||
- if Setting.enable_emoji_reaction
|
||||
= f.simple_fields_for :settings, current_user.settings do |ff|
|
||||
.fields-group
|
||||
= ff.input :stop_emoji_reaction_streaming, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_stop_emoji_reaction_streaming'), hint: I18n.t('simple_form.hints.defaults.setting_stop_emoji_reaction_streaming')
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
.fields-group
|
||||
= ff.input :default_sensitive, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_default_sensitive'), hint: I18n.t('simple_form.hints.defaults.setting_default_sensitive')
|
||||
|
||||
.fields-row
|
||||
.fields-group.fields-row__column.fields-row__column-12
|
||||
= ff.input :emoji_reaction_policy, kmyblue: true, collection: ['allow', 'outside_only', 'followers_only', 'following_only', 'mutuals_only', 'block'], label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.setting_emoji_reaction_policy_items.#{item}")]) }, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', include_blank: false, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_emoji_reaction_policy'), hint: false, warning_hint: I18n.t('simple_form.hints.defaults.setting_emoji_reaction_policy')
|
||||
- if Setting.enable_emoji_reaction
|
||||
.fields-row
|
||||
.fields-group.fields-row__column.fields-row__column-12
|
||||
= ff.input :emoji_reaction_policy, kmyblue: true, collection: ['allow', 'outside_only', 'followers_only', 'following_only', 'mutuals_only', 'block'], label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.setting_emoji_reaction_policy_items.#{item}")]) }, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', include_blank: false, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_emoji_reaction_policy'), hint: false, warning_hint: I18n.t('simple_form.hints.defaults.setting_emoji_reaction_policy')
|
||||
|
||||
- if @dtl_enabled
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ class DeliveryEmojiReactionWorker
|
|||
include AccountScope
|
||||
|
||||
def perform(payload_json, status_id, reacted_account_id)
|
||||
return unless Setting.enable_emoji_reaction
|
||||
|
||||
status = Status.find(status_id)
|
||||
reacted_account = Account.find(reacted_account_id)
|
||||
|
||||
|
|
|
@ -1674,6 +1674,7 @@ en:
|
|||
reactions:
|
||||
errors:
|
||||
banned: Banned reaction from the user
|
||||
disabled: Stamp is disabled on this server
|
||||
duplication: Cannot react same things
|
||||
limit_reached: Limit of different reactions reached
|
||||
unrecognized_emoji: is not a recognized emoji
|
||||
|
|
|
@ -1613,6 +1613,7 @@ ja:
|
|||
reactions:
|
||||
errors:
|
||||
banned: 指定ユーザーからのリアクションは禁止されています
|
||||
disabled: このサーバーではスタンプ機能は無効になっています
|
||||
duplication: 同じリアクションを複数行おうとしました
|
||||
limit_reached: リアクションの種類が上限に達しました
|
||||
unrecognized_emoji: は絵文字として認識されていません
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue