Remove @context in embedded collection
This commit is contained in:
@@ -30,6 +30,15 @@ ObjectType = Dict[str, Any]
|
||||
ObjectOrIDType = Union[str, ObjectType]
|
||||
|
||||
|
||||
COLLECTION_CTX = [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
{
|
||||
"Hashtag": "as:Hashtag",
|
||||
"sensitive": "as:sensitive",
|
||||
}
|
||||
]
|
||||
|
||||
class ActivityType(Enum):
|
||||
"""Supported activity `type`."""
|
||||
ANNOUNCE = 'Announce'
|
||||
@@ -1196,11 +1205,11 @@ def build_ordered_collection(col, q=None, cursor=None, map_func=None, limit=50,
|
||||
data = [_remove_id(doc) for doc in data]
|
||||
if map_func:
|
||||
data = [map_func(doc) for doc in data]
|
||||
|
||||
|
||||
# No cursor, this is the first page and we return an OrderedCollection
|
||||
if not cursor:
|
||||
resp = {
|
||||
'@context': CTX_AS,
|
||||
'@context': COLLECTION_CTX,
|
||||
'id': f'{BASE_URL}/{col_name}',
|
||||
'totalItems': total_items,
|
||||
'type': ActivityType.ORDERED_COLLECTION.value,
|
||||
@@ -1223,7 +1232,7 @@ def build_ordered_collection(col, q=None, cursor=None, map_func=None, limit=50,
|
||||
|
||||
# If there's a cursor, then we return an OrderedCollectionPage
|
||||
resp = {
|
||||
'@context': CTX_AS,
|
||||
'@context': COLLECTION_CTX,
|
||||
'type': ActivityType.ORDERED_COLLECTION_PAGE.value,
|
||||
'id': BASE_URL + '/' + col_name + '?cursor=' + start_cursor,
|
||||
'totalItems': total_items,
|
||||
|
Reference in New Issue
Block a user