Merge pull request #1724 from dmnyc/feat/quote-repost-reply-to-label
feat: show "Replying to" label in quoted notes
This commit is contained in:
@@ -116,6 +116,31 @@ fun ReplyInformationChannel(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
fun ReplyToLabel(
|
||||
replyingDirectlyTo: Note,
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: INav,
|
||||
) {
|
||||
val user = replyingDirectlyTo.author ?: return
|
||||
|
||||
FlowRow {
|
||||
Text(
|
||||
stringRes(id = R.string.replying_to),
|
||||
fontSize = 13.sp,
|
||||
color = MaterialTheme.colorScheme.placeholderText,
|
||||
)
|
||||
|
||||
ReplyInfoMention(
|
||||
user = user,
|
||||
prefix = "",
|
||||
accountViewModel = accountViewModel,
|
||||
onUserTagClick = { nav.nav(routeFor(it)) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ReplyInfoMention(
|
||||
user: User,
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
||||
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.note.LoadDecryptedContent
|
||||
import com.vitorpamplona.amethyst.ui.note.ReplyInformationChannel
|
||||
import com.vitorpamplona.amethyst.ui.note.ReplyNoteComposition
|
||||
import com.vitorpamplona.amethyst.ui.note.elements.DisplayUncitedHashtags
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -49,10 +50,13 @@ import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
|
||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hasHashtags
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.hasAnyTaggedUser
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.taggedUsers
|
||||
import com.vitorpamplona.quartz.nip10Notes.BaseThreadedEvent
|
||||
import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent
|
||||
import com.vitorpamplona.quartz.nip14Subject.subject
|
||||
import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
||||
@Composable
|
||||
fun RenderTextEvent(
|
||||
@@ -98,6 +102,17 @@ fun RenderTextEvent(
|
||||
ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav)
|
||||
Spacer(modifier = StdVertSpacer)
|
||||
}
|
||||
} else if (!unPackReply && !makeItShort && noteEvent is BaseThreadedEvent && noteEvent.hasAnyTaggedUser()) {
|
||||
val mentions =
|
||||
remember(noteEvent) {
|
||||
noteEvent.taggedUsers().map { it.pubKey }.toImmutableList()
|
||||
}
|
||||
ReplyInformationChannel(
|
||||
replyTo = persistentListOf(note),
|
||||
mentions = mentions,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
// Check if this is an audio-only event (content is just an audio URL with waveform IMeta)
|
||||
|
||||
Reference in New Issue
Block a user