parent
3e8b4752a1
commit
903b9ad347
7 changed files with 31 additions and 2 deletions
app
models
views/settings/preferences/other
config/locales
spec/models
|
@ -61,6 +61,7 @@ module Account::OtherSettings
|
||||||
|
|
||||||
def show_emoji_reaction?(account)
|
def show_emoji_reaction?(account)
|
||||||
return false unless Setting.enable_emoji_reaction
|
return false unless Setting.enable_emoji_reaction
|
||||||
|
return true if local? && account&.local? && user.setting_slip_local_emoji_reaction
|
||||||
|
|
||||||
case emoji_reaction_policy
|
case emoji_reaction_policy
|
||||||
when :block
|
when :block
|
||||||
|
@ -104,7 +105,9 @@ module Account::OtherSettings
|
||||||
end
|
end
|
||||||
|
|
||||||
def public_settings_for_local
|
def public_settings_for_local
|
||||||
public_settings.merge(public_master_settings)
|
s = public_settings
|
||||||
|
s = s.merge({ 'emoji_reaction_policy' => 'allow' }) if local? && user&.setting_slip_local_emoji_reaction
|
||||||
|
s.merge(public_master_settings)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -91,6 +91,10 @@ module User::HasSettings
|
||||||
settings['emoji_reaction_policy']
|
settings['emoji_reaction_policy']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def setting_slip_local_emoji_reaction
|
||||||
|
settings['slip_local_emoji_reaction']
|
||||||
|
end
|
||||||
|
|
||||||
def setting_unfollow_modal
|
def setting_unfollow_modal
|
||||||
settings['web.unfollow_modal']
|
settings['web.unfollow_modal']
|
||||||
end
|
end
|
||||||
|
|
|
@ -37,6 +37,7 @@ class UserSettings
|
||||||
setting :stop_emoji_reaction_streaming, default: false
|
setting :stop_emoji_reaction_streaming, default: false
|
||||||
setting :emoji_reaction_streaming_notify_impl2, default: false
|
setting :emoji_reaction_streaming_notify_impl2, default: false
|
||||||
setting :emoji_reaction_policy, default: :allow, in: %w(allow outside_only followers_only following_only mutuals_only block)
|
setting :emoji_reaction_policy, default: :allow, in: %w(allow outside_only followers_only following_only mutuals_only block)
|
||||||
|
setting :slip_local_emoji_reaction, default: false
|
||||||
setting :unsafe_limited_distribution, default: false
|
setting :unsafe_limited_distribution, default: false
|
||||||
setting :dtl_force_visibility, default: :unchange, in: %w(unchange public public_unlisted unlisted)
|
setting :dtl_force_visibility, default: :unchange, in: %w(unchange public public_unlisted unlisted)
|
||||||
setting :dtl_force_searchability, default: :unchange, in: %w(unchange public public_unlisted)
|
setting :dtl_force_searchability, default: :unchange, in: %w(unchange public public_unlisted)
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
.fields-group.fields-row__column.fields-row__column-12
|
.fields-group.fields-row__column.fields-row__column-12
|
||||||
= ff.input :emoji_reaction_policy, kmyblue: true, collection: %w(allow outside_only followers_only following_only mutuals_only block), label_method: ->(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')
|
= ff.input :emoji_reaction_policy, kmyblue: true, collection: %w(allow outside_only followers_only following_only mutuals_only block), label_method: ->(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')
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= ff.input :slip_local_emoji_reaction, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_slip_local_emoji_reaction')
|
||||||
|
|
||||||
- if @dtl_enabled
|
- if @dtl_enabled
|
||||||
|
|
||||||
%h4= t 'preferences.dtl'
|
%h4= t 'preferences.dtl'
|
||||||
|
|
|
@ -289,6 +289,7 @@ en:
|
||||||
setting_show_quote_in_public: Show quotes in public timelines
|
setting_show_quote_in_public: Show quotes in public timelines
|
||||||
setting_simple_timeline_menu: Reduce post menu on timeline
|
setting_simple_timeline_menu: Reduce post menu on timeline
|
||||||
setting_single_ref_to_quote: Deliver single reference to other server as quote
|
setting_single_ref_to_quote: Deliver single reference to other server as quote
|
||||||
|
setting_slip_local_emoji_reaction: Allow bypassing emoji reaction from local users
|
||||||
setting_stay_privacy: Not change privacy after post
|
setting_stay_privacy: Not change privacy after post
|
||||||
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
|
||||||
|
|
|
@ -301,6 +301,7 @@ ja:
|
||||||
setting_show_emoji_reaction_on_timeline: タイムライン上に他の人のつけたスタンプを表示する
|
setting_show_emoji_reaction_on_timeline: タイムライン上に他の人のつけたスタンプを表示する
|
||||||
setting_simple_timeline_menu: タイムライン上でメニューの項目を減らす
|
setting_simple_timeline_menu: タイムライン上でメニューの項目を減らす
|
||||||
setting_single_ref_to_quote: 参照が1つしかない投稿は、他のサーバーには引用として配信する
|
setting_single_ref_to_quote: 参照が1つしかない投稿は、他のサーバーには引用として配信する
|
||||||
|
setting_slip_local_emoji_reaction: ローカルユーザーに限って上記設定を無視してスタンプを許可する
|
||||||
setting_stay_privacy: 投稿時に公開範囲を保存する
|
setting_stay_privacy: 投稿時に公開範囲を保存する
|
||||||
setting_stop_emoji_reaction_streaming: スタンプのストリーミングを停止する
|
setting_stop_emoji_reaction_streaming: スタンプのストリーミングを停止する
|
||||||
setting_system_font_ui: システムのデフォルトフォントを使う
|
setting_system_font_ui: システムのデフォルトフォントを使う
|
||||||
|
|
|
@ -256,7 +256,8 @@ RSpec.describe Account do
|
||||||
|
|
||||||
describe '#allow_emoji_reaction?' do
|
describe '#allow_emoji_reaction?' do
|
||||||
let(:policy) { :allow }
|
let(:policy) { :allow }
|
||||||
let(:reactioned) { Fabricate(:user, settings: { emoji_reaction_policy: policy }).account }
|
let(:allow_local) { false }
|
||||||
|
let(:reactioned) { Fabricate(:user, settings: { emoji_reaction_policy: policy, slip_local_emoji_reaction: allow_local }).account }
|
||||||
let(:followee) { Fabricate(:account) }
|
let(:followee) { Fabricate(:account) }
|
||||||
let(:follower) { Fabricate(:account) }
|
let(:follower) { Fabricate(:account) }
|
||||||
let(:mutual) { Fabricate(:account) }
|
let(:mutual) { Fabricate(:account) }
|
||||||
|
@ -411,6 +412,21 @@ RSpec.describe Account do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when policy is block but allow local only' do
|
||||||
|
let(:policy) { :block }
|
||||||
|
let(:allow_local) { true }
|
||||||
|
let(:local) { Fabricate(:user).account }
|
||||||
|
let(:remote) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/actor') }
|
||||||
|
|
||||||
|
it 'does not allow remote' do
|
||||||
|
expect(reactioned.allow_emoji_reaction?(remote)).to be false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'allows local' do
|
||||||
|
expect(reactioned.allow_emoji_reaction?(local)).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when reactioned is remote user' do
|
context 'when reactioned is remote user' do
|
||||||
let(:reactioned) { Fabricate(:account, domain: 'foo.bar', uri: 'https://foo.bar/actor', settings: { emoji_reaction_policy: :following_only }) }
|
let(:reactioned) { Fabricate(:account, domain: 'foo.bar', uri: 'https://foo.bar/actor', settings: { emoji_reaction_policy: :following_only }) }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue