1
0
Fork 0
forked from gitea/nas

Fix stop emoji reaction streaming to user settings

This commit is contained in:
KMY 2023-05-10 10:06:55 +09:00
parent 7d237611d9
commit dbc34a8213
16 changed files with 55 additions and 19 deletions

View file

@ -20,7 +20,7 @@ class Settings::ProfilesController < Settings::BaseController
private
def account_params
params.require(:account).permit(:display_name, :note, :avatar, :header, :locked, :my_actor_type, :searchability, :dissubscribable, :stop_emoji_reaction_streaming, :group_allow_private_message, :discoverable, :hide_collections, fields_attributes: [:name, :value])
params.require(:account).permit(:display_name, :note, :avatar, :header, :locked, :my_actor_type, :searchability, :dissubscribable, :group_allow_private_message, :discoverable, :hide_collections, fields_attributes: [:name, :value])
end
def set_account

View file

@ -53,7 +53,6 @@
# group_allow_private_message :boolean
# searchability :integer default("private"), not null
# dissubscribable :boolean default(FALSE), not null
# stop_emoji_reaction_streaming :boolean default(FALSE)
#
class Account < ApplicationRecord

View file

@ -43,6 +43,10 @@ module HasUserSettings
settings['send_without_domain_blocks']
end
def setting_stop_emoji_reaction_streaming
settings['stop_emoji_reaction_streaming']
end
def setting_unfollow_modal
settings['web.unfollow_modal']
end

View file

@ -20,6 +20,7 @@ class UserSettings
setting :reject_public_unlisted_subscription, default: false
setting :reject_unlisted_subscription, default: false
setting :send_without_domain_blocks, default: false
setting :stop_emoji_reaction_streaming, default: false
namespace :web do
setting :crop_images, default: true

View file

@ -33,3 +33,7 @@
= ff.input :'interactions.must_be_follower', wrapper: :with_label, label: I18n.t('simple_form.labels.interactions.must_be_follower')
= 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')
.fields-group
= f.simple_fields_for :settings, current_user.settings do |ff|
= ff.input :stop_emoji_reaction_streaming, as: :boolean, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_stop_emoji_reaction_streaming'), hint: I18n.t('simple_form.hints.defaults.setting_stop_emoji_reaction_streaming')

View file

@ -41,9 +41,6 @@
.fields-group
= f.input :dissubscribable, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.dissubscribable')
.fields-group
= f.input :stop_emoji_reaction_streaming, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.stop_emoji_reaction_streaming')
%hr.spacer/
.fields-row

View file

@ -12,12 +12,12 @@ class DeliveryEmojiReactionWorker
status = Status.find(status_id.to_i)
if status.present?
scope_status(status).where.not(stop_emoji_reaction_streaming: true).find_each do |account|
redis.publish("timeline:#{account.id}", payload_json) if redis.exists?("subscribed:timeline:#{account.id}")
scope_status(status).includes(:user).find_each do |account|
redis.publish("timeline:#{account.id}", payload_json) if !account.user&.setting_stop_emoji_reaction_streaming && redis.exists?("subscribed:timeline:#{account.id}")
end
if !([:public, :unlisted, :public_unlisted].include?(status.visibility.to_sym)) && status.account_id != my_account_id &&
redis.exists?("subscribed:timeline:#{status.account_id}")
if [:public, :unlisted, :public_unlisted].exclude?(status.visibility.to_sym) && status.account_id != my_account_id &&
redis.exists?("subscribed:timeline:#{status.account_id}")
redis.publish("timeline:#{status.account_id}", payload_json)
end
end