mlem icon indicating copy to clipboard operation
mlem copied to clipboard

Tier-Abstracted Content Models

Open EricBAndrews opened this issue 1 month ago • 0 comments

Requirements

  • [x] There are no existing issues for this feature.
  • [x] This is a request for a single feature (create multiple issues for multiple feature requests).

Description

Create unified models that abstract tiers altogether.

Summarizing Slack design discussion:

AnyPost contains a PostPropertiesProviding, a new protocol that defines the set of properties a post can have. Software-specific providers (e.g., LemmyPostPropertiesProviding, PiefedPostPropertiesProviding) conform to the protocol and internally contain raw snapshots. Accessing a property from a provider returns .present(property), .absent(property) (indicating upgrade required), or .unavailable (indicating no API support). If .absent is returned from the provider, AnyPost fetches the higher tier data before returning the property.

This has the consequence that every property would be async, which would require us to implement more placeholder views, but in return tier becomes completely irrelevant. Any post function would be available from anywhere the post is present, we only need to use the single model throughout the whole codebase, and writing generic classes (e.g., UpdateQueues) becomes much simpler. We can also initialize models with no data (effectively a PostStub), on which any property access triggers an upgrade.

EricBAndrews avatar Nov 15 '25 18:11 EricBAndrews