@@ -22,17 +22,22 @@ final class ReaderPostCellViewModel {
2222 weak var viewController : ReaderStreamViewController ?
2323
2424 let post : ReaderPost ?
25- private var followCommentsService : FollowCommentsService ?
2625 private var faviconTask : Task < Void , Never > ?
2726
2827 deinit {
2928 faviconTask? . cancel ( )
3029 }
3130
32- init ( post: ReaderPost ) {
31+ init ( post: ReaderPost , topic : ReaderAbstractTopic ? ) {
3332 self . post = post
3433
35- self . author = post. blogNameForDisplay ( ) ?? " "
34+ let isP2 = ( topic as? ReaderSiteTopic ) ? . isP2Type == true
35+
36+ if isP2 {
37+ self . author = post. authorDisplayName ?? " "
38+ } else {
39+ self . author = post. blogNameForDisplay ( ) ?? " "
40+ }
3641 self . time = post. dateForDisplay ( ) ? . toShortString ( ) ?? " – "
3742 self . title = post. titleForDisplay ( ) ?? " "
3843 self . details = post. contentPreviewForDisplay ( ) ?? " "
@@ -47,8 +52,10 @@ final class ReaderPostCellViewModel {
4752 self . likeCount = post. likeCount? . intValue ?? 0
4853 self . isLiked = post. isLiked ( )
4954
50- if let avatarURL = post. siteIconForDisplay ( ofSize: Int ( ReaderPostCell . avatarSize) ) {
51- self . avatarURL = avatarURL
55+ if isP2 {
56+ self . avatarURL = post. authorAvatarURL. flatMap ( URL . init)
57+ } else if let avatarURL = post. siteIconForDisplay ( ofSize: Int ( ReaderPostCell . avatarSize) ) {
58+ self . avatarURL = avatarURL
5259 } else if let blogURL = post. blogURL. flatMap ( URL . init) {
5360 if let faviconURL = FaviconService . shared. cachedFavicon ( forURL: blogURL) {
5461 self . avatarURL = faviconURL
0 commit comments