@@ -45,7 +45,6 @@ import dev.dimension.flare.model.ReferenceType
4545import dev.dimension.flare.ui.model.mapper.name
4646import dev.dimension.flare.ui.model.mapper.parseXQTCustomDateTime
4747import dev.dimension.flare.ui.model.mapper.screenName
48- import kotlin.collections.toMap
4948import kotlin.time.Clock
5049
5150internal object XQT {
@@ -267,21 +266,21 @@ private fun TweetUnion.toDbStatusWithUser(accountKey: MicroBlogKey): DbStatusWit
267266private fun toDbStatusWithUser (
268267 tweet : Tweet ,
269268 accountKey : MicroBlogKey ,
270- ): DbStatusWithUser {
269+ ): DbStatusWithUser ? {
271270 val user =
272271 tweet.core
273272 ?.userResults
274273 ?.result
275274 ?.let {
276275 it as ? User
277- }?.toDbUser(accountKey) ? : throw IllegalStateException ( " Tweet.user should not be null" )
276+ }?.toDbUser(accountKey) ? : return null
278277 return DbStatusWithUser (
279278 data =
280279 DbStatus (
281280 statusKey =
282281 MicroBlogKey (
283282 id = tweet.restId,
284- host = user.userKey .host,
283+ host = accountKey .host,
285284 ),
286285 content = StatusContent .XQT (tweet),
287286 userKey = user.userKey,
@@ -295,24 +294,6 @@ private fun toDbStatusWithUser(
295294 )
296295}
297296
298- private fun TimelineTweet.toDbUser (accountKey : MicroBlogKey ): DbUser {
299- val tweet =
300- when (tweetResults.result) {
301- is Tweet -> tweetResults.result
302- null , is TweetTombstone -> throw IllegalStateException (" Tweet tombstone should not be saved" )
303- is TweetWithVisibilityResults -> tweetResults.result.tweet
304- }
305- val user =
306- tweet.core
307- ?.userResults
308- ?.result
309- ?.let {
310- it as ? User
311- }
312- ? : throw IllegalStateException (" Tweet.user should not be null" )
313- return user.toDbUser(accountKey = accountKey)
314- }
315-
316297internal fun User.toDbUser (accountKey : MicroBlogKey ) =
317298 DbUser (
318299 userKey =
0 commit comments