Closed trwnh closed 1 month ago
I think we have what we need to read the contents of a collection -- either paged or unpaged.
So the questions becomes, for collections that don't have a prescribed order as part of the AP standard (actor collections, probably replies
, shares
, likes
, ...), is it possible to do operations like Insert, Move within collection, or setting an automated sort order?
We don't have this in AP right now. This would need to be created as an extension; I'd be happy to collaborate on this.
Another possiblity is using Update
to update the Collection or CollectionPage. So, you could change items
from [A, B, C, D] to [A, D, C, B]. This kind of manipulation makes Add
and Remove
less useful, though. Are they even still required?
The problem with updating the collection or collection page directly is that these are only rarely representative of the internal storage on the server side, and are more likely to be abstract representations. So updating may not make sense here.
The other option @trwnh mentioned is using the sort order FEP, and including a manual property for sort order.
So, this is marked as Needs FEP; @trwnh gave verbal assent on the issue triage call; so I will close this issue, with the possibility of considering working on this in a next version.
Collections are usually* ordered by insertion order, but there's nothing in the ActivityPub C2S API to insert at a specific point, or change the sort order of individual items.
In RDF lists (rdf:List), typically there is a singly-linked list constructed using rdf:first and rdf:next; it ends when rdf:next points to rdf:nil. Patching the rdf:List is done using the standard linked list algorithm of updating rdf:next of the previous element to the inserted element, and the previous rdf:rest becomes the rdf:rest of the inserted element.
The AS2 Collection mechanism doesn't seem to have an equivalent method.
EDIT: Schema.org seems to use a nextItem/previousItem or position, so you could do a sortIndex or weight property maybe