mirror of https://github.com/Siphonay/mastodon
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
This commit is contained in:
parent
5236a62861
commit
b25e42a77f
|
@ -328,7 +328,7 @@ class AtomSerializer
|
|||
end
|
||||
|
||||
def conversation_uri(conversation)
|
||||
return conversation.uri if conversation.uri.present?
|
||||
return conversation.uri if conversation.uri?
|
||||
TagManager.instance.unique_tag(conversation.created_at, conversation.id, 'Conversation')
|
||||
end
|
||||
|
||||
|
|
|
@ -17,4 +17,11 @@ class Mention < ApplicationRecord
|
|||
has_one :notification, as: :activity, dependent: :destroy
|
||||
|
||||
validates :account, uniqueness: { scope: :status }
|
||||
|
||||
delegate(
|
||||
:username,
|
||||
:acct,
|
||||
to: :account,
|
||||
prefix: true
|
||||
)
|
||||
end
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -34,7 +34,7 @@ class PostStatusService < BaseService
|
|||
process_mentions_service.call(status)
|
||||
process_hashtags_service.call(status)
|
||||
|
||||
LinkCrawlWorker.perform_async(status.id) unless status.spoiler_text.present?
|
||||
LinkCrawlWorker.perform_async(status.id) unless status.spoiler_text?
|
||||
DistributionWorker.perform_async(status.id)
|
||||
Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id)
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class ProcessFeedService < BaseService
|
|||
|
||||
Rails.logger.debug "Queuing remote status #{status.id} (#{id}) for distribution"
|
||||
|
||||
LinkCrawlWorker.perform_async(status.id) unless status.spoiler_text.present?
|
||||
LinkCrawlWorker.perform_async(status.id) unless status.spoiler_text?
|
||||
DistributionWorker.perform_async(status.id)
|
||||
|
||||
status
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
node(:url) { |mention| TagManager.instance.url_for(mention.account) }
|
||||
node(:acct) { |mention| mention.account.acct }
|
||||
node(:acct) { |mention| mention.account_acct }
|
||||
node(:id) { |mention| mention.account_id }
|
||||
node(:username) { |mention| mention.account.username }
|
||||
node(:username) { |mention| mention.account_username }
|
||||
|
|
Loading…
Reference in New Issue