From 4a51272509acbe5355bc8a41f08b3405395e01e4 Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Sat, 10 Jun 2017 13:54:53 +0800 Subject: [PATCH] fixed #867 --- .../model/ParcelableStatusExtensions.kt | 4 +-- .../twidere/fragment/StatusFragment.kt | 28 +++++-------------- .../loader/statuses/ConversationLoader.kt | 7 ++--- .../org/mariotaku/twidere/util/LinkCreator.kt | 7 ++--- 4 files changed, 13 insertions(+), 33 deletions(-) diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/extension/model/ParcelableStatusExtensions.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/extension/model/ParcelableStatusExtensions.kt index ed9017dba..d311a193f 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/extension/model/ParcelableStatusExtensions.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/extension/model/ParcelableStatusExtensions.kt @@ -8,8 +8,8 @@ import org.mariotaku.twidere.util.UriUtils import org.mariotaku.twidere.util.Utils -val ParcelableStatus.originalId: String - get() = if (is_retweet) retweet_id else id +inline val ParcelableStatus.originalId: String + get() = if (is_retweet) (retweet_id ?: id) else id val ParcelableStatus.media_type: Int get() = media?.firstOrNull()?.type ?: 0 diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt index 5d5d3551f..d8220c947 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt @@ -482,7 +482,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks { - if (status.is_retweet) { - IntentUtils.openStatusRetweeters(context, status.account_key, - status.retweet_id) - } else { - IntentUtils.openStatusRetweeters(context, status.account_key, - status.id) - } + IntentUtils.openStatusRetweeters(context, status.account_key, + status.originalId) } KEY_FAVORITE_COUNT -> { - if (status.is_retweet) { - IntentUtils.openStatusFavoriters(context, status.account_key, - status.retweet_id) - } else { - IntentUtils.openStatusFavoriters(context, status.account_key, - status.id) - } + IntentUtils.openStatusFavoriters(context, status.account_key, + status.originalId) } } } @@ -2147,8 +2136,5 @@ class StatusFragment : BaseFragment(), LoaderCallbacks { when (account.type) { diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/util/LinkCreator.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/util/LinkCreator.kt index 31a7bae57..652d0617e 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/util/LinkCreator.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/util/LinkCreator.kt @@ -22,6 +22,7 @@ package org.mariotaku.twidere.util import android.net.Uri import org.mariotaku.twidere.TwidereConstants.* import org.mariotaku.twidere.annotation.AccountType +import org.mariotaku.twidere.extension.model.originalId import org.mariotaku.twidere.model.ParcelableStatus import org.mariotaku.twidere.model.ParcelableUser import org.mariotaku.twidere.model.UserKey @@ -107,11 +108,7 @@ object LinkCreator { if (USER_TYPE_FANFOU_COM == status.account_key.host) { return getFanfouStatusLink(status.id) } - if (status.is_retweet) { - return getTwitterStatusLink(status.user_screen_name, status.retweet_id) - } else { - return getTwitterStatusLink(status.user_screen_name, status.id) - } + return getTwitterStatusLink(status.user_screen_name, status.originalId) } fun getQuotedStatusWebLink(status: ParcelableStatus): Uri {