diff --git a/app/javascript/mastodon/components/status.jsx b/app/javascript/mastodon/components/status.jsx index adee90cbd6d6ca..73384bb3c84adf 100644 --- a/app/javascript/mastodon/components/status.jsx +++ b/app/javascript/mastodon/components/status.jsx @@ -358,7 +358,7 @@ class Status extends ImmutablePureComponent { }; render () { - const { intl, hidden, featured, unread, showThread, scrollKey, pictureInPicture, previousId, nextInReplyToId, rootId } = this.props; + const { intl, hidden, featured, unread, muted, showThread, scrollKey, pictureInPicture, previousId, nextInReplyToId, rootId } = this.props; let { status, account, ...other } = this.props; @@ -366,7 +366,7 @@ class Status extends ImmutablePureComponent { return null; } - const handlers = this.props.muted ? {} : { + const handlers = muted ? {} : { reply: this.handleHotkeyReply, favourite: this.handleHotkeyFavourite, boost: this.handleHotkeyBoost, @@ -385,7 +385,7 @@ class Status extends ImmutablePureComponent { if (hidden) { return ( -
+
{status.getIn(['account', 'display_name']) || status.getIn(['account', 'username'])} {status.get('content')}
@@ -414,7 +414,7 @@ class Status extends ImmutablePureComponent { let visibilityIcon = visibilityIconInfo[status.get('limited_scope') || status.get('visibility_ex')] || visibilityIconInfo[status.get('visibility')]; if (this.state.forceFilter === undefined ? matchedFilters : this.state.forceFilter) { - const minHandlers = this.props.muted ? {} : { + const minHandlers = muted ? {} : { moveUp: this.handleHotkeyMoveUp, moveDown: this.handleHotkeyMoveDown, }; @@ -479,7 +479,7 @@ class Status extends ImmutablePureComponent { } else if (status.get('media_attachments').size > 0) { const language = status.getIn(['translation', 'language']) || status.get('language'); - if (this.props.muted) { + if (muted) { media = ( ); } - } else if (status.get('card') && !this.props.muted) { + } else if (status.get('card') && !muted) { media = ( 0 ? : null; const withExpiration = status.get('expires_at') ? : null; + const quote = !muted && status.get('quote_id') && + return ( -
+
{prepend} -
+
{(connectReply || connectUp || connectToRoot) &&
} {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */} @@ -630,7 +632,7 @@ class Status extends ImmutablePureComponent { {...statusContentProps} /> - + {quote} {(!isCardMediaWithSensitive || !status.get('hidden')) && media} diff --git a/app/models/custom_filter.rb b/app/models/custom_filter.rb index f443d08ca66b4c..a50c556b79b967 100644 --- a/app/models/custom_filter.rb +++ b/app/models/custom_filter.rb @@ -104,10 +104,11 @@ def self.apply_cached_filters(cached_filters, status, following = false) # ruboc if rules[:keywords].present? match = rules[:keywords].match(status.proper.searchable_text) match = rules[:keywords].match(status.proper.references.pluck(:text).join("\n\n")) if match.nil? && status.proper.references.exists? + match = rules[:keywords].match(status.proper.references.pluck(:spoiler_text).join("\n\n")) if match.nil? && status.proper.references.exists? end keyword_matches = [match.to_s] unless match.nil? - status_matches = [status.id, status.reblog_of_id].compact & rules[:status_ids] if rules[:status_ids].present? + status_matches = [status.id, status.reblog_of_id, status.quote_id].compact & rules[:status_ids] if rules[:status_ids].present? next if keyword_matches.blank? && status_matches.blank? diff --git a/app/models/status.rb b/app/models/status.rb index 0111f3d7050abb..85b1a4a071d7ac 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -231,6 +231,10 @@ def quote @quote ||= reference_objects.where(quote: true).first&.target_status end + def quote_id + reference_objects.where(quote: true).first&.target_status_id + end + def within_realtime_window? created_at >= REAL_TIME_WINDOW.ago end diff --git a/app/presenters/status_relationships_presenter.rb b/app/presenters/status_relationships_presenter.rb index b2c5e8c26989d9..77d26f20c22b56 100644 --- a/app/presenters/status_relationships_presenter.rb +++ b/app/presenters/status_relationships_presenter.rb @@ -14,6 +14,7 @@ def initialize(statuses, current_account_id = nil, **options) @favourites_map = {} @bookmarks_map = {} @mutes_map = {} + @blocks_map = {} @pins_map = {} @filters_map = {} @emoji_reaction_allows_map = nil @@ -28,7 +29,7 @@ def initialize(statuses, current_account_id = nil, **options) @favourites_map = Status.favourites_map(status_ids, current_account_id).merge(options[:favourites_map] || {}) @bookmarks_map = Status.bookmarks_map(status_ids, current_account_id).merge(options[:bookmarks_map] || {}) @mutes_map = Status.mutes_map(conversation_ids, current_account_id).merge(options[:mutes_map] || {}) - @blocks_map = Status.blocks_map(conversation_ids, current_account_id).merge(options[:blocks_map] || {}) + @blocks_map = Status.blocks_map(statuses.map(&:account_id), current_account_id).merge(options[:blocks_map] || {}) @pins_map = Status.pins_map(pinnable_status_ids, current_account_id).merge(options[:pins_map] || {}) @emoji_reaction_allows_map = Status.emoji_reaction_allows_map(status_ids, current_account_id).merge(options[:emoji_reaction_allows_map] || {}) @attributes_map = options[:attributes_map] || {} diff --git a/app/services/process_references_service.rb b/app/services/process_references_service.rb index e1ac835bd39fdc..7cee3c2ec99060 100644 --- a/app/services/process_references_service.rb +++ b/app/services/process_references_service.rb @@ -31,7 +31,7 @@ def call(status, reference_parameters, urls: nil, fetch_remote: true, no_fetch_u @status.save! end - quote_ur + create_notifications! end @@ -45,14 +45,14 @@ def self.need_process?(status, reference_parameters, urls) reference_parameters.any? || (urls || []).any? || FormattingHelper.extract_status_plain_text(status).scan(REFURL_EXP).pluck(3).uniq.any? end - def self.perform_worker_async(status, reference_parameters, urls, quote_urls) + def self.perform_worker_async(status, reference_parameters, urls, quote_urls = []) return unless need_process?(status, reference_parameters, urls) Rails.cache.write("status_reference:#{status.id}", true, expires_in: 10.minutes) ProcessReferencesWorker.perform_async(status.id, reference_parameters, urls, [], quote_urls || []) end - def self.call_service(status, reference_parameters, urls, quote_urls) + def self.call_service(status, reference_parameters, urls, quote_urls = []) return unless need_process?(status, reference_parameters, urls) ProcessReferencesService.new.call(status, reference_parameters || [], urls: urls || [], fetch_remote: false, quote_urls: quote_urls)