mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-23 04:02:07 +01:00
Add not_allowed
scope for PreviewCardTrend
(#29599)
This commit is contained in:
parent
cf76380c91
commit
32938dadd7
2 changed files with 4 additions and 2 deletions
|
@ -15,5 +15,7 @@ class PreviewCardTrend < ApplicationRecord
|
||||||
include RankedTrend
|
include RankedTrend
|
||||||
|
|
||||||
belongs_to :preview_card
|
belongs_to :preview_card
|
||||||
|
|
||||||
scope :allowed, -> { where(allowed: true) }
|
scope :allowed, -> { where(allowed: true) }
|
||||||
|
scope :not_allowed, -> { where(allowed: false) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -86,8 +86,8 @@ class Trends::Links < Trends::Base
|
||||||
|
|
||||||
def request_review
|
def request_review
|
||||||
PreviewCardTrend.pluck('distinct language').flat_map do |language|
|
PreviewCardTrend.pluck('distinct language').flat_map do |language|
|
||||||
score_at_threshold = PreviewCardTrend.where(language: language, allowed: true).by_rank.ranked_below(options[:review_threshold]).first&.score || 0
|
score_at_threshold = PreviewCardTrend.where(language: language).allowed.by_rank.ranked_below(options[:review_threshold]).first&.score || 0
|
||||||
preview_card_trends = PreviewCardTrend.where(language: language, allowed: false).joins(:preview_card)
|
preview_card_trends = PreviewCardTrend.where(language: language).not_allowed.joins(:preview_card)
|
||||||
|
|
||||||
preview_card_trends.filter_map do |trend|
|
preview_card_trends.filter_map do |trend|
|
||||||
preview_card = trend.preview_card
|
preview_card = trend.preview_card
|
||||||
|
|
Loading…
Reference in a new issue