DEV: add `guardian` argument to `TopicsFilter` (#237)
As it's been added in discourse/discourse#31908
This commit is contained in:
parent
c10bd4dcf6
commit
b31bc6e037
|
@ -1,3 +1,4 @@
|
||||||
|
< 3.5.0.beta2-dev: 7f9a0bb2a75217731de3a0168302b66453152c09
|
||||||
< 3.5.0.beta1-dev: 0390f3611ea3b635877b349e9fb38aac01e19837
|
< 3.5.0.beta1-dev: 0390f3611ea3b635877b349e9fb38aac01e19837
|
||||||
< 3.4.0.beta2-dev: 6d52b8cfa8b3e2920aa3f12fc52673b88f53f776
|
< 3.4.0.beta2-dev: 6d52b8cfa8b3e2920aa3f12fc52673b88f53f776
|
||||||
< 3.4.0.beta1-dev: 4ebcd1187b59290b79db8c61c89df9f72bf1363c
|
< 3.4.0.beta1-dev: 4ebcd1187b59290b79db8c61c89df9f72bf1363c
|
||||||
|
|
|
@ -119,9 +119,8 @@ after_initialize do
|
||||||
add_to_serializer(:current_user, :votes_count) { object.vote_count }
|
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 }
|
add_to_serializer(:current_user, :votes_left) { [object.vote_limit - object.vote_count, 0].max }
|
||||||
|
|
||||||
filter_order_votes = ->(scope, order_direction) do
|
filter_order_votes = ->(scope, order_direction, _guardian) do
|
||||||
scope = scope.joins(:topic_vote_count)
|
scope.joins(:topic_vote_count).order(
|
||||||
scope.order(
|
|
||||||
"COALESCE(topic_voting_topic_vote_count.votes_count, 0)::integer #{order_direction}",
|
"COALESCE(topic_voting_topic_vote_count.votes_count, 0)::integer #{order_direction}",
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue