DROID-1788 Widgets | Fix | Collection in the widget contains random objects (#594)
This commit is contained in:
parent
03e844d8bb
commit
d1450251c6
|
@ -4,6 +4,7 @@ import com.anytypeio.anytype.core_models.DV
|
|||
import com.anytypeio.anytype.core_models.DVFilter
|
||||
import com.anytypeio.anytype.core_models.DVFilterCondition
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.ObjectType
|
||||
import com.anytypeio.anytype.core_models.ObjectTypeIds
|
||||
import com.anytypeio.anytype.core_models.ObjectView
|
||||
import com.anytypeio.anytype.core_models.ObjectWrapper
|
||||
|
@ -161,7 +162,7 @@ class DataViewListWidgetContainer(
|
|||
addAll(ObjectSearchConstants.defaultDataViewFilters(space))
|
||||
add(
|
||||
DVFilter(
|
||||
relation = Relations.TYPE,
|
||||
relation = Relations.TYPE_UNIQUE_KEY,
|
||||
condition = DVFilterCondition.NOT_IN,
|
||||
value = listOf(
|
||||
ObjectTypeIds.OBJECT_TYPE,
|
||||
|
@ -181,8 +182,8 @@ class DataViewListWidgetContainer(
|
|||
},
|
||||
limit = resolveLimit(),
|
||||
source = source.setOf,
|
||||
collection = if (source.type.contains(ObjectTypeIds.COLLECTION))
|
||||
source.id
|
||||
collection = if (isCollection())
|
||||
root
|
||||
else
|
||||
null
|
||||
)
|
||||
|
@ -193,3 +194,8 @@ class DataViewListWidgetContainer(
|
|||
limit = widget.limit
|
||||
)
|
||||
}
|
||||
|
||||
fun ObjectView.isCollection(): Boolean {
|
||||
val wrapper = ObjectWrapper.Basic(details.getOrDefault(root, emptyMap()))
|
||||
return wrapper.layout == ObjectType.Layout.COLLECTION
|
||||
}
|
|
@ -2443,7 +2443,7 @@ class HomeScreenViewModelTest {
|
|||
addAll(ObjectSearchConstants.defaultDataViewFilters(defaultSpaceConfig.space))
|
||||
add(
|
||||
DVFilter(
|
||||
relation = Relations.TYPE,
|
||||
relation = Relations.TYPE_UNIQUE_KEY,
|
||||
condition = DVFilterCondition.NOT_IN,
|
||||
value = listOf(
|
||||
ObjectTypeIds.OBJECT_TYPE,
|
||||
|
|
Loading…
Reference in New Issue
Block a user