mlem icon indicating copy to clipboard operation
mlem copied to clipboard

[2.x] PostWrapper

Open Sjmarf opened this issue 1 year ago • 0 comments

Currently, we use a CommentWrapper defined in Mlem that wraps Comment2 and conforms to Comment2Providing. The class stores Mlem-specific information about the comment, such as its collapse state.

At some we could consider making a PostWrapper for posts. Some examples of information we might want to store:

  • Whether the user has tapped to un-blur an NSFW image. Currently, if you tap to un-blur and then open the post in expanded view, the image is blurred again in the expanded view. This isn't ideal UX. #1153.
  • Translation text (#928). If the user translates a post, we'd want to remember that information when they open the expanded post rather than re-translating.
  • Markdown node trees (maybe)? Currently we're parsing as the user is scrolling. Parsing ahead of time and storing the tree in PostWrapper might be beneficial performance-wise.
  • This may also be needed for multi-accounts. We could conform PostWrapper to Post2Providing, and it's computed properties (votes, saved etc) could choose a value from one of several stored Post2 instances.

Sjmarf avatar Jul 23 '24 11:07 Sjmarf