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 1b774fd + 0070d71 commit 774a095
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion app/services/notify_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def call(recipient, type, activity)
@recipient = recipient
@activity = activity
@notification = Notification.new(account: @recipient, type: type, activity: @activity)
@mentions = Mention.where(status_id: activity.status_id)

return if recipient.user.nil? || blocked?

Expand Down Expand Up @@ -52,7 +53,10 @@ def optional_non_following?
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
@recipient.user.settings['interactions.must_be_human'] && (
@notification.from_account.followers_count < ENV.fetch('SPAMMER_FOLLOWER_THRESHOLD', 5).to_i ||
@notification.from_account.created_at > ENV.fetch('SPAMMER_CREATION_THRESHOLD', 6).to_i.day.ago
) && @mentions.count > ENV.fetch('SPAMMER_MENTION_THRESHOLD', 1).to_i
end

def message?
Expand Down
2 changes: 1 addition & 1 deletion config/locales/simple_form.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +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
must_be_human: Block notifications from users who appear to be spammers
invite:
comment: Comment
invite_request:
Expand Down
2 changes: 1 addition & 1 deletion config/locales/simple_form.ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ ja:
must_be_follower: フォロワー以外からの通知をブロック
must_be_following: フォローしていないユーザーからの通知をブロック
must_be_following_dm: フォローしていないユーザーからのダイレクトメッセージをブロック
must_be_human: フォロワーが少ないユーザーからの通知をブロック
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
2
3
end

def default_prerelease
Expand Down

0 comments on commit 774a095

Please sign in to comment.