From a7941176791ec8ad56e45efbb449b9d09a580a6b Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 15 Mar 2022 07:51:55 +0100 Subject: [PATCH] Fix individually approved/rejected statuses/links showing as pending review (#17787) --- app/models/preview_card.rb | 4 ++++ app/models/status.rb | 4 ++++ app/views/admin/trends/links/_preview_card.html.haml | 4 ++-- app/views/admin/trends/statuses/_status.html.haml | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/models/preview_card.rb b/app/models/preview_card.rb index 0f9e23fa1d..0d2c32c353 100644 --- a/app/models/preview_card.rb +++ b/app/models/preview_card.rb @@ -80,6 +80,10 @@ class PreviewCard < ApplicationRecord end end + def requires_review? + attributes['trendable'].nil? && (provider.nil? || provider.requires_review?) + end + def requires_review_notification? attributes['trendable'].nil? && (provider.nil? || provider.requires_review_notification?) end diff --git a/app/models/status.rb b/app/models/status.rb index f2c55090b1..5b984543e2 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -294,6 +294,10 @@ class Status < ApplicationRecord end end + def requires_review? + attributes['trendable'].nil? && account.requires_review? + end + def requires_review_notification? attributes['trendable'].nil? && account.requires_review_notification? end diff --git a/app/views/admin/trends/links/_preview_card.html.haml b/app/views/admin/trends/links/_preview_card.html.haml index d88e06bfdf..2e6a0c62f0 100644 --- a/app/views/admin/trends/links/_preview_card.html.haml +++ b/app/views/admin/trends/links/_preview_card.html.haml @@ -1,4 +1,4 @@ -.batch-table__row{ class: [preview_card.provider&.requires_review? && 'batch-table__row--attention', !preview_card.provider&.requires_review? && !preview_card.trendable? && 'batch-table__row--muted'] } +.batch-table__row{ class: [preview_card.requires_review? && 'batch-table__row--attention', !preview_card.requires_review? && !preview_card.trendable? && 'batch-table__row--muted'] } %label.batch-table__row__select.batch-table__row__select--aligned.batch-checkbox = f.check_box :preview_card_ids, { multiple: true, include_hidden: false }, preview_card.id @@ -25,6 +25,6 @@ - if preview_card.decaying? • = t('admin.trends.tags.peaked_on_and_decaying', date: l(preview_card.max_score_at.to_date, format: :short)) - - elsif preview_card.provider&.requires_review? + - elsif preview_card.requires_review? • = t('admin.trends.pending_review') diff --git a/app/views/admin/trends/statuses/_status.html.haml b/app/views/admin/trends/statuses/_status.html.haml index 50a8553492..0c463c6b10 100644 --- a/app/views/admin/trends/statuses/_status.html.haml +++ b/app/views/admin/trends/statuses/_status.html.haml @@ -1,4 +1,4 @@ -.batch-table__row{ class: [status.account.requires_review? && 'batch-table__row--attention', !status.account.requires_review? && !status.trendable? && 'batch-table__row--muted'] } +.batch-table__row{ class: [status.requires_review? && 'batch-table__row--attention', !status.requires_review? && !status.trendable? && 'batch-table__row--muted'] } %label.batch-table__row__select.batch-table__row__select--aligned.batch-checkbox = f.check_box :status_ids, { multiple: true, include_hidden: false }, status.id @@ -28,6 +28,6 @@ - if status.trendable? && (rank = Trends.statuses.rank(status.id)) • %abbr{ title: t('admin.trends.tags.current_score', score: Trends.statuses.score(status.id)) }= t('admin.trends.tags.trending_rank', rank: rank + 1) - - elsif status.account.requires_review? + - elsif status.requires_review? • = t('admin.trends.pending_review')