Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions indra/newview/alsceneexplorerpredicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,23 @@ bool matches(const ItemFacts& item, const Constraints& c)
if (c.mOwnerMode != OWNER_ANY)
{
// Avatars are their own "owner" so owner filters behave sensibly for
// them; object rows apply the predicate only once props have arrived.
// them. Objects with unresolved props stay hidden until the fetch
// lands and the row re-filters.
if (!item.mIsAvatar && !rec.mPropsValid)
return false;

const LLUUID& owner = item.mIsAvatar ? item.mItemId : rec.mOwnerId;
const bool group_owned = !item.mIsAvatar && rec.mGroupOwned;
if (item.mIsAvatar || rec.mPropsValid)
switch (c.mOwnerMode)
{
switch (c.mOwnerMode)
{
case OWNER_MINE: if (owner != c.mAgentId) return false; break;
case OWNER_GROUP: if (!group_owned) return false; break;
case OWNER_OTHERS: if (owner == c.mAgentId || group_owned) return false; break;
case OWNER_SPECIFIC:
if (owner != c.mOwnerId && !(group_owned && rec.mGroupId == c.mOwnerId))
return false;
break;
default: break;
}
case OWNER_MINE: if (owner != c.mAgentId) return false; break;
case OWNER_GROUP: if (!group_owned) return false; break;
case OWNER_OTHERS: if (owner == c.mAgentId || group_owned) return false; break;
case OWNER_SPECIFIC:
if (owner != c.mOwnerId && !(group_owned && rec.mGroupId == c.mOwnerId))
return false;
break;
default: break;
}
}

Expand Down
12 changes: 10 additions & 2 deletions indra/newview/tests/alsceneexplorerpredicate_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ namespace tut
}

// Owner gating: avatars are their own owner; objects without props yet
// pass owner modes (the predicate can't judge what it doesn't know).
// fail owner modes until the reply lands.
template<> template<>
void predicate_object::test<7>()
{
Expand All @@ -187,7 +187,15 @@ namespace tut
mFacts.mIsAvatar = false;
mFacts.mItemId = mRec.mId;
mRec.mPropsValid = false;
ensure("unresolved props pass owner modes", matches(mFacts, mC));
ensure("unresolved props fail owner modes", !matches(mFacts, mC));

mRec.mPropsValid = true;
mRec.mOwnerId = mAgentId;
ensure("resolved props re-apply owner modes", matches(mFacts, mC));

mRec.mPropsValid = false;
mC.mOwnerMode = OWNER_ANY;
ensure("unresolved props pass without an owner mode", matches(mFacts, mC));
}

// Geometry mask: empty = any; otherwise the item's kind must be in it.
Expand Down
Loading