Use explicit points for following and hidden tags (#20032)
This commit is contained in:
parent
49a45f0618
commit
a6d8767aaa
2 changed files with 5 additions and 4 deletions
|
|
@ -172,11 +172,12 @@ class Tag < ActsAsTaggableOn::Tag
|
|||
|
||||
# returns the tags that are followed by the user
|
||||
# @param user [User] the user to check
|
||||
# @param points [Range] the range of points to check for (default is 0 (including 0) to infinity)
|
||||
# @param points [Range] the range of explicit points to check for (default is 0 (including 0) to infinity)
|
||||
# @return [ActiveRecord::Relation<Tag>] the tags followed by the user
|
||||
def self.followed_by(user, points = (0...))
|
||||
def self.followed_by(user, explicit_points = (0...))
|
||||
joins("INNER JOIN follows ON tags.id = follows.followable_id")
|
||||
.where(follows: { follower_id: user.id, followable_type: "ActsAsTaggableOn::Tag", points: points })
|
||||
.where(follows: { follower_id: user.id, followable_type: "ActsAsTaggableOn::Tag",
|
||||
explicit_points: explicit_points })
|
||||
.order("follows.points DESC")
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ RSpec.describe Tag do
|
|||
second_followed.update explicit_points: 0
|
||||
|
||||
antifollowed = user.follow(antifollowed_tag)
|
||||
antifollowed.update explicit_points: -5
|
||||
antifollowed.update(explicit_points: -5, implicit_points: 6)
|
||||
|
||||
other.follow(other_followed_tag)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue