DEV: add `guardian` argument to `TopicsFilter` (#237)

As it's been added in discourse/discourse#31908
This commit is contained in:
Régis Hanol 2025-03-24 11:34:48 +01:00 committed by GitHub
parent c10bd4dcf6
commit b31bc6e037
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -1,3 +1,4 @@
< 3.5.0.beta2-dev: 7f9a0bb2a75217731de3a0168302b66453152c09
< 3.5.0.beta1-dev: 0390f3611ea3b635877b349e9fb38aac01e19837
< 3.4.0.beta2-dev: 6d52b8cfa8b3e2920aa3f12fc52673b88f53f776
< 3.4.0.beta1-dev: 4ebcd1187b59290b79db8c61c89df9f72bf1363c

View File

@ -119,9 +119,8 @@ after_initialize do
add_to_serializer(:current_user, :votes_count) { object.vote_count }
add_to_serializer(:current_user, :votes_left) { [object.vote_limit - object.vote_count, 0].max }
filter_order_votes = ->(scope, order_direction) do
scope = scope.joins(:topic_vote_count)
scope.order(
filter_order_votes = ->(scope, order_direction, _guardian) do
scope.joins(:topic_vote_count).order(
"COALESCE(topic_voting_topic_vote_count.votes_count, 0)::integer #{order_direction}",
)
end