Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
mohemohe committed Feb 18, 2024
2 parents 33dacdb + 31d7443 commit 1b774fd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/user_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class KeyError < Error; end
setting :must_be_follower, default: false
setting :must_be_following, default: false
setting :must_be_following_dm, default: false
setting :must_be_human, default: false
end

def initialize(original_hash)
Expand Down
5 changes: 5 additions & 0 deletions app/services/notify_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def optional_non_following?
@recipient.user.settings['interactions.must_be_following'] && !following_sender?
end

def optional_non_spammer?
@recipient.user.settings['interactions.must_be_human'] && @notification.from_account.followers_count < ENV.fetch('SPAMMER_FOLLOWER_THRESHOLD', 1).to_i
end

def message?
@notification.type == :mention
end
Expand Down Expand Up @@ -120,6 +124,7 @@ def blocked?
blocked ||= optional_non_follower?
blocked ||= optional_non_following?
blocked ||= optional_non_following_and_direct?
blocked ||= optional_non_spammer?
blocked ||= conversation_muted?
blocked ||= blocked_mention? if @notification.type == :mention
blocked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@
= 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')
= ff.input :'interactions.must_be_human', wrapper: :with_label, label: I18n.t('simple_form.labels.interactions.must_be_human')
1 change: 1 addition & 0 deletions config/locales/simple_form.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ en:
must_be_follower: Block notifications from non-followers
must_be_following: Block notifications from people you don't follow
must_be_following_dm: Block direct messages from people you don't follow
must_be_human: Block notifications from users with few followers
invite:
comment: Comment
invite_request:
Expand Down
1 change: 1 addition & 0 deletions config/locales/simple_form.ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ ja:
must_be_follower: フォロワー以外からの通知をブロック
must_be_following: フォローしていないユーザーからの通知をブロック
must_be_following_dm: フォローしていないユーザーからのダイレクトメッセージをブロック
must_be_human: フォロワーが少ないユーザーからの通知をブロック
invite:
comment: コメント
invite_request:
Expand Down
2 changes: 1 addition & 1 deletion lib/mastodon/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def suffix
end

def revision
1
2
end

def default_prerelease
Expand Down

0 comments on commit 1b774fd

Please sign in to comment.