Merge pull request #2823 from evazion/fix-fav-order
Fix ordering of favlist
This commit is contained in:
@@ -960,12 +960,12 @@ class Post < ActiveRecord::Base
|
|||||||
rescue PostVote::Error
|
rescue PostVote::Error
|
||||||
end
|
end
|
||||||
|
|
||||||
def favorited_user_ids
|
# users who favorited this post, ordered by users who favorited it first
|
||||||
fav_string.scan(/\d+/)
|
|
||||||
end
|
|
||||||
|
|
||||||
def favorited_users
|
def favorited_users
|
||||||
User.find(favorited_user_ids).reject(&:hide_favorites?)
|
favorited_user_ids = fav_string.scan(/\d+/).map(&:to_i)
|
||||||
|
visible_users = User.find(favorited_user_ids).reject(&:hide_favorites?)
|
||||||
|
ordered_users = visible_users.index_by(&:id).slice(*favorited_user_ids).values
|
||||||
|
ordered_users
|
||||||
end
|
end
|
||||||
|
|
||||||
def favorite_groups(active_id=nil)
|
def favorite_groups(active_id=nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user