mlem icon indicating copy to clipboard operation
mlem copied to clipboard

[0.19] Utilize new `creatorIsModerator` field

Open EricBAndrews opened this issue 2 years ago • 1 comments

0.19 introduces the creatorIsModerator field to the APIPostView. This will let us display mod flairs in feed! PostModel should be updated to make use of this and posts in feed should appropriately flair mods.

EricBAndrews avatar Nov 11 '23 21:11 EricBAndrews

Had a brief look at this, and I think this would be far easier to do once we've more fully adopted the middleware system... implementing this system new basically means passing an optional PostModel to UserLabelView in addition to the APIPost that we currently pass, which is less than ideal.

An alternative is to add an initialiser to PostModel that accepts an APIPost rather than an APIPostView, so that we can create a PostModel wherever we only have access to an APIPost. This system is used in both UserModel and CommunityModel. The issue with this is that we'd have to make many of PostModel's properties optional, including the creator and community attributes, because APIPost doesn't supply that data. This raises the question of what our approach towards 'missing' data in Models should be moving forward - the optional-properties approach that we're using in UserModel and CommunityModel works, but it would feel weird having to null coalesce the creator attribute of PostModel whenever we access it. I'm not sure what the best solution for that is though, unfortunately.

Sjmarf avatar Nov 11 '23 22:11 Sjmarf