From 43709532d6b48c15ba9131e294df964363a3e893 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Thu, 21 Apr 2022 18:46:43 +0200 Subject: [PATCH] fix unparsed html in "replying to" toggle (#2448) --- .../tusky/components/drafts/DraftsActivity.kt | 3 ++- .../components/search/fragments/SearchStatusesFragment.kt | 8 ++++---- .../java/com/keylesspalace/tusky/fragment/SFragment.java | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftsActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftsActivity.kt index e580f554..db6a8a31 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftsActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftsActivity.kt @@ -35,6 +35,7 @@ import com.keylesspalace.tusky.components.compose.ComposeActivity import com.keylesspalace.tusky.databinding.ActivityDraftsBinding import com.keylesspalace.tusky.db.DraftEntity import com.keylesspalace.tusky.di.ViewModelFactory +import com.keylesspalace.tusky.util.parseAsMastodonHtml import com.keylesspalace.tusky.util.visible import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import kotlinx.coroutines.flow.collectLatest @@ -100,7 +101,7 @@ class DraftsActivity : BaseActivity(), DraftActionListener { content = draft.content, contentWarning = draft.contentWarning, inReplyToId = draft.inReplyToId, - replyingStatusContent = status.content.toString(), + replyingStatusContent = status.content.parseAsMastodonHtml().toString(), replyingStatusAuthor = status.account.localUsername, draftAttachments = draft.attachments, poll = draft.poll, diff --git a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt index 23ff1b07..11d90da4 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt @@ -97,7 +97,7 @@ class SearchStatusesFragment : SearchFragment(), Status } override fun onReply(position: Int) { - searchAdapter.peek(position)?.status?.let { status -> + searchAdapter.peek(position)?.let { status -> reply(status) } } @@ -199,8 +199,8 @@ class SearchStatusesFragment : SearchFragment(), Status fun newInstance() = SearchStatusesFragment() } - private fun reply(status: Status) { - val actionableStatus = status.actionableStatus + private fun reply(status: StatusViewData.Concrete) { + val actionableStatus = status.actionable val mentionedUsernames = actionableStatus.mentions.map { it.username } .toMutableSet() .apply { @@ -216,7 +216,7 @@ class SearchStatusesFragment : SearchFragment(), Status contentWarning = actionableStatus.spoilerText, mentionedUsernames = mentionedUsernames, replyingStatusAuthor = actionableStatus.account.localUsername, - replyingStatusContent = actionableStatus.content.toString() + replyingStatusContent = status.content.toString() ) ) startActivity(intent) diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java index b1a47ad8..bb02807d 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java @@ -15,6 +15,8 @@ package com.keylesspalace.tusky.fragment; +import static com.keylesspalace.tusky.util.StatusParsingHelper.parseAsMastodonHtml; + import android.Manifest; import android.app.DownloadManager; import android.content.ClipData; @@ -150,7 +152,7 @@ public abstract class SFragment extends Fragment implements Injectable { composeOptions.setContentWarning(contentWarning); composeOptions.setMentionedUsernames(mentionedUsernames); composeOptions.setReplyingStatusAuthor(actionableStatus.getAccount().getLocalUsername()); - composeOptions.setReplyingStatusContent(actionableStatus.getContent().toString()); + composeOptions.setReplyingStatusContent(parseAsMastodonHtml(actionableStatus.getContent()).toString()); Intent intent = ComposeActivity.startIntent(getContext(), composeOptions); getActivity().startActivity(intent);