Skip to content
Closed
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
13 changes: 13 additions & 0 deletions Source/ActivityPub.Types/AS/APActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ public required ASLink Outbox
set => Entity.Outbox = value;
}

/// <summary>
/// An optional endpoint used for wide delivery of activities addressed to public or other collections
/// </summary>
public ASLink? SharedInbox
{
get => Entity.SharedInbox;
set => Entity.SharedInbox = value;
}

/// <summary>
/// A reference to an ActivityStreams collection of the actors that this actor is following.
/// This is a list of everybody that the actor has followed, added as a side effect.
Expand Down Expand Up @@ -155,6 +164,10 @@ public sealed class APActorEntity : ASEntity<APActor, APActorEntity>
/// <inheritdoc cref="APActor.Outbox" />
[JsonPropertyName("outbox")]
public ASLink? Outbox { get; set; }

/// <inheritdoc cref="APActor.SharedInbox"/>
[JsonPropertyName("sharedInbox")]
public ASLink? SharedInbox { get; set; }

/// <inheritdoc cref="APActor.Following" />
[JsonPropertyName("following")]
Expand Down
1 change: 1 addition & 0 deletions Source/ActivityPub.Types/AS/Collection/ASCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public ASCollection(TypeMap typeMap, ASCollectionEntity? entity) : base(typeMap,
static ASCollection IASModel<ASCollection>.FromGraph(TypeMap typeMap) => new(typeMap, null);

private ASCollectionEntity Entity { get; }


/// <summary>
/// In a paged Collection, indicates the page that contains the most recently updated member items.
Expand Down
4 changes: 2 additions & 2 deletions Source/ActivityPub.Types/AS/Collection/ASOrderedCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace ActivityPub.Types.AS.Collection;
/// </remarks>
/// <seealso href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collection" />
/// <seealso href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection" />
public class ASOrderedCollection : ASObject, IASModel<ASOrderedCollection, ASOrderedCollectionEntity, ASObject>, IEnumerable<Linkable<ASObject>>
public class ASOrderedCollection : ASCollection, IASModel<ASOrderedCollection, ASOrderedCollectionEntity, ASCollection>, IEnumerable<Linkable<ASObject>>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this, unfortunately, won't work because ASCollection has a separate entity with a separate copy of the collection. It may be possible to support this by loading the same entity into both classes - I'll take a look into that.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not that big of a deal, honestly. I'll split out the shared inbox. The rest is workable as-is. The AS2 inheritance tree is nonsensical.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it also breaks for ASOrderedCollectionPage, which should logically be assignable to both ASOrderedCollection and ASCollectionPage

{
/// <summary>
/// ActivityStreams type name for "OrderedCollection" types.
Expand All @@ -46,7 +46,7 @@ public ASOrderedCollection(TypeMap typeMap, ASOrderedCollectionEntity? entity) :
static ASOrderedCollection IASModel<ASOrderedCollection>.FromGraph(TypeMap typeMap) => new(typeMap, null);

private ASOrderedCollectionEntity Entity { get; }


/// <summary>
/// In a paged Collection, indicates the page that contains the most recently updated member items.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ public int? StartIndex
/// <summary>
/// Converts a list of objects into an ordered collection page.
/// </summary>
public static implicit operator ASOrderedCollectionPage(List<ASObject> collection) => new() { Items = new LinkableList<ASObject>(collection) };
public static implicit operator ASOrderedCollectionPage(List<ASObject> collection) => new()
{
Items = new LinkableList<ASObject>(collection)
};
}

/// <inheritdoc cref="ASOrderedCollectionPage" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void ShouldIncludePropertiesFromBaseTypes()
"type": "Person",
"inbox": "https://example.com/actor/inbox",
"outbox": "https://example.com/actor/outbox",
"sharedInbox": "https://example.com/actor/shared_inbox",
"image": {
"type": "Image"
},
Expand All @@ -60,6 +61,7 @@ public void ShouldIncludePropertiesFromBaseTypes()
var personUnderTest = ObjectUnderTest.As<PersonActor>();
personUnderTest.Inbox.HRef.Should().Be("https://example.com/actor/inbox");
personUnderTest.Outbox.HRef.Should().Be("https://example.com/actor/outbox");
personUnderTest.SharedInbox?.HRef.Should().Be("https://example.com/actor/shared_inbox");
personUnderTest.Image.Should().NotBeNull();
personUnderTest.Id.Should().Be("https://example.com/actor/id");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public void ShouldIncludePropertiesFromBaseTypes()
// From APActor
Inbox = "https://example.com/actor/inbox",
Outbox = "https://example.com/actor/outbox",
SharedInbox = "https://example.com/actor/shared_inbox",

// From ASObject
Image = new ImageObject(),
Expand Down