Skip to content

Commit

Permalink
bugfix for status key in timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Tlaster committed Sep 26, 2024
1 parent 21cbf3f commit 8429714
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ data class UiTimeline internal constructor(
val icon: Icon,
val type: MessageType,
val onClicked: ClickContext.() -> Unit,
val statusKey: MicroBlogKey,
) {
val itemKey: String
get() =
Expand All @@ -158,6 +159,7 @@ data class UiTimeline internal constructor(
if (user != null) {
append(user.key)
}
append(statusKey.toString())
}

enum class Icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ internal fun FeedViewPostReasonUnion.render(
),
)
},
statusKey = MicroBlogKey(id = data?.uri?.atUri.orEmpty(), host = accountKey.host),
)
},
content = data?.renderStatus(accountKey, event),
Expand Down Expand Up @@ -198,6 +199,7 @@ internal fun ListNotificationsNotification.render(accountKey: MicroBlogKey): UiT
onClicked = {
launcher.launch(AppDeepLink.Profile(accountKey = accountKey, userKey = user.key))
},
statusKey = MicroBlogKey(id = uri.atUri, host = accountKey.host),
),
content = UiTimeline.ItemContent.User(author.render(accountKey)),
platformType = PlatformType.Bluesky,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ internal fun Notification.render(
),
)
},
statusKey = MicroBlogKey(id ?: "", accountKey.host),
)
}
return UiTimeline(
Expand All @@ -107,6 +108,8 @@ internal fun Status.render(
): UiTimeline {
requireNotNull(account) { "account is null" }
val user = account.render(accountKey)
val currentStatus = this.renderStatus(accountKey, event)
val actualStatus = (references[ReferenceType.Retweet] as? StatusContent.Mastodon)?.data ?: this
val topMessage =
if (reblog == null) {
null
Expand All @@ -123,10 +126,9 @@ internal fun Status.render(
),
)
},
statusKey = currentStatus.statusKey,
)
}
val currentStatus = this.renderStatus(accountKey, event)
val actualStatus = (references[ReferenceType.Retweet] as? StatusContent.Mastodon)?.data ?: this
return UiTimeline(
topMessage = topMessage,
content =
Expand All @@ -139,7 +141,6 @@ internal fun Status.render(
),
)
},
statusKey = currentStatus.statusKey,
),
platformType = PlatformType.Mastodon,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ internal fun Notification.render(
launcher.launch(AppDeepLink.Profile(accountKey = accountKey, userKey = user.key))
}
},
statusKey = MicroBlogKey(id, accountKey.host),
)
return UiTimeline(
topMessage = topMessage,
Expand Down Expand Up @@ -241,6 +242,8 @@ internal fun Note.render(
): UiTimeline {
val user = user.render(accountKey)
val renote = (references[ReferenceType.Retweet] as? StatusContent.Misskey)?.data
val currentStatus = this.renderStatus(accountKey, event)
val actualStatus = renote ?: this
val topMessage =
if (renote == null || !text.isNullOrEmpty()) {
null
Expand All @@ -257,10 +260,9 @@ internal fun Note.render(
),
)
},
statusKey = currentStatus.statusKey,
)
}
val currentStatus = this.renderStatus(accountKey, event)
val actualStatus = renote ?: this
return UiTimeline(
topMessage = topMessage,
content =
Expand All @@ -273,7 +275,6 @@ internal fun Note.render(
),
)
},
statusKey = currentStatus.statusKey,
),
platformType = PlatformType.Misskey,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ internal fun Status.render(
.Custom(it),
onClicked = {
},
statusKey = MicroBlogKey(id, vvoHost),
)
},
content = renderStatus(accountKey, event),
Expand Down Expand Up @@ -454,6 +455,7 @@ internal fun Attitude.render(
)
}
},
statusKey = MicroBlogKey(id.toString(), vvoHost),
),
content = content,
platformType = PlatformType.VVo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ internal fun TopLevel.renderNotifications(
launcher.launch(url)
}
},
statusKey = MicroBlogKey(id = notification.id.orEmpty(), host = accountKey.host),
),
content = itemContent,
platformType = PlatformType.xQt,
Expand Down Expand Up @@ -188,6 +189,7 @@ internal fun TopLevel.renderNotifications(
onClicked = {
launcher.launch(AppDeepLink.Profile(accountKey = accountKey, userKey = renderedUser.key))
},
statusKey = MicroBlogKey(id = notification?.id.orEmpty(), host = accountKey.host),
),
content = data,
platformType = PlatformType.xQt,
Expand Down Expand Up @@ -220,6 +222,7 @@ internal fun Tweet.render(
onClicked = {
launcher.launch(AppDeepLink.Profile(accountKey = accountKey, userKey = user.key))
},
statusKey = currentTweet.statusKey,
)
} else {
null
Expand All @@ -235,7 +238,6 @@ internal fun Tweet.render(
),
)
},
statusKey = currentTweet.statusKey,
),
topMessage = topMessage,
platformType = PlatformType.xQt,
Expand Down

0 comments on commit 8429714

Please sign in to comment.