Say which side of a private reaction you are on #155

Merged
paulhitt merged 1 commits from feat/private-reaction-labels into main 2026-09-12 01:19:57 +00:00
2 changed files with 12 additions and 1 deletions
@@ -1785,6 +1785,7 @@ fun ColumnScope.ChatScreen(
Bubble(
line = line,
model = model,
myUserId = myUserId,
authorName =
when {
line.mine || chat.group == null -> {
@@ -2318,6 +2319,8 @@ private fun ColumnScope.VoiceComposer(
private fun Bubble(
line: Session.Line,
model: MessengerViewModel,
/** Ours, so a private reaction can say which side of it you are on. */
myUserId: Long = 0L,
authorName: String = "",
picture: io.flamenet.e2e.Attachment.Ref? = null,
) {
@@ -2530,7 +2533,12 @@ private fun Bubble(
// should not be mistaken for one the group watched arrive.
line.privateReactions.entries.sortedBy { it.key }.forEach { (emoji, who) ->
Text(
if (who.size == 1) "$emoji private" else "$emoji ${who.size} private",
run {
// The person who sent it is told who saw it;
// the author is told that nobody else did.
val side = if (myUserId in who) "only them" else "only you"
if (who.size == 1) "$emoji $side" else "$emoji ${who.size} $side"
},
fontSize = 13.sp,
color = Palette.SecondaryText,
modifier =
@@ -73,5 +73,8 @@ class PrivateReactionSendTest {
assertTrue(chat.contains("react-private-toggle"), "no way to choose a private reaction")
assertTrue(chat.contains("privately = privately"))
assertTrue(chat.contains("line.privateReactions.entries"), "private reactions are not drawn")
// The same chip has to read correctly from both sides of it.
assertTrue(chat.contains("\"only them\""))
assertTrue(chat.contains("\"only you\""))
}
}