Oops, using item proxies broke closet comparison. Fix.
Turns out we need to assign closeted to actual items, not the item proxies, since that's what we check against. (I would've thought they're backed by the same instance of the item anyway, but, whatever. The fix works :P)
This commit is contained in:
parent
62f584e366
commit
2df0133cff
1 changed files with 7 additions and 4 deletions
|
@ -26,13 +26,15 @@ class ClosetHangersController < ApplicationController
|
||||||
visible_groups = @user.closet_hangers_groups_visible_to(@perspective_user)
|
visible_groups = @user.closet_hangers_groups_visible_to(@perspective_user)
|
||||||
@unlisted_closet_hangers_by_owned = find_unlisted_closet_hangers_by_owned(visible_groups)
|
@unlisted_closet_hangers_by_owned = find_unlisted_closet_hangers_by_owned(visible_groups)
|
||||||
|
|
||||||
items = Item::ProxyArray.new
|
item_proxies = Item::ProxyArray.new
|
||||||
|
items = []
|
||||||
|
|
||||||
@closet_lists_by_owned.each do |owned, lists|
|
@closet_lists_by_owned.each do |owned, lists|
|
||||||
lists.each do |list|
|
lists.each do |list|
|
||||||
list.hangers.each do |hanger|
|
list.hangers.each do |hanger|
|
||||||
hanger.item_proxy = Item::Proxy.new(hanger.item)
|
hanger.item_proxy = Item::Proxy.new(hanger.item)
|
||||||
items << hanger.item_proxy
|
item_proxies << hanger.item_proxy
|
||||||
|
items << hanger.item
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -40,11 +42,12 @@ class ClosetHangersController < ApplicationController
|
||||||
@unlisted_closet_hangers_by_owned.each do |owned, hangers|
|
@unlisted_closet_hangers_by_owned.each do |owned, hangers|
|
||||||
hangers.each do |hanger|
|
hangers.each do |hanger|
|
||||||
hanger.item_proxy = Item::Proxy.new(hanger.item)
|
hanger.item_proxy = Item::Proxy.new(hanger.item)
|
||||||
items << hanger.item_proxy
|
item_proxies << hanger.item_proxy
|
||||||
|
items << hanger.item
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
items.prepare_partial(:item_link_partial)
|
item_proxies.prepare_partial(:item_link_partial)
|
||||||
|
|
||||||
if @public_perspective && user_signed_in?
|
if @public_perspective && user_signed_in?
|
||||||
current_user.assign_closeted_to_items!(items)
|
current_user.assign_closeted_to_items!(items)
|
||||||
|
|
Loading…
Reference in a new issue