From b25e42a77f4b3472bc519e8a394b2cfe0e063e4c Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 31 May 2017 14:38:17 -0400 Subject: Misc tidying and clean ups (#3445) * Remove trailing whitespace in i18n mailers * Use query methods instead of #present? on AR attributes * Delegate Status#account_domain method * Delegate Mention #account_username and #account_acct methods --- app/models/status.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/models/status.rb') diff --git a/app/models/status.rb b/app/models/status.rb index a371083d0..e75ac7070 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -73,6 +73,8 @@ class Status < ApplicationRecord cache_associated :account, :application, :media_attachments, :tags, :stream_entry, mentions: :account, reblog: [:account, :application, :stream_entry, :tags, :media_attachments, mentions: :account], thread: :account + delegate :domain, to: :account, prefix: true + def reply? !in_reply_to_id.nil? || attributes['reply'] end @@ -288,7 +290,7 @@ class Status < ApplicationRecord def filter_from_context?(status, account) should_filter = account&.blocking?(status.account_id) - should_filter ||= account&.domain_blocking?(status.account.domain) + should_filter ||= account&.domain_blocking?(status.account_domain) should_filter ||= account&.muting?(status.account_id) should_filter ||= (status.account.silenced? && !account&.following?(status.account_id)) should_filter ||= !StatusPolicy.new(account, status).show? -- cgit