From: Eugen Date: Wed, 5 Apr 2017 00:53:39 +0000 (+0200) Subject: Merge pull request #858 from krainboltgreene/patch-6 X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=2edeb3fe1c6212380a1c053f124fbaed1c47a261;p=mastodon.git Merge pull request #858 from krainboltgreene/patch-6 Use active record shorthand --- 2edeb3fe1c6212380a1c053f124fbaed1c47a261 diff --cc app/lib/feed_manager.rb index 28e712704,9398d6c70..2cca1cefe --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@@ -116,14 -116,14 +116,14 @@@ class FeedManage false end - def filter_from_mentions?(status, receiver) + def filter_from_mentions?(status, receiver_id) check_for_blocks = [status.account_id] - check_for_blocks.concat(status.mentions.select('account_id').map(&:account_id)) + check_for_blocks.concat(status.mentions.pluck(:account_id)) check_for_blocks.concat([status.in_reply_to_account]) if status.reply? && !status.in_reply_to_account_id.nil? - should_filter = receiver.id == status.account_id # Filter if I'm mentioning myself - should_filter ||= receiver.blocking?(check_for_blocks) # or it's from someone I blocked, in reply to someone I blocked, or mentioning someone I blocked - should_filter ||= (status.account.silenced? && !receiver.following?(status.account)) # of if the account is silenced and I'm not following them + should_filter = receiver_id == status.account_id # Filter if I'm mentioning myself + should_filter ||= Block.where(account_id: receiver_id, target_account_id: check_for_blocks).any? # or it's from someone I blocked, in reply to someone I blocked, or mentioning someone I blocked + should_filter ||= (status.account.silenced? && !Follow.where(account_id: receiver_id, target_account_id: status.account_id).exists?) # of if the account is silenced and I'm not following them should_filter end