diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt index 00d765abfe..b7bf8ec2ff 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt @@ -337,7 +337,9 @@ private fun RelayGroupRoomCompose( val authorName by observeUserName(author, accountViewModel) "$authorName: ${noteEvent.content.take(200)}" } else { - "" + // Event-less placeholder row for a just-joined group with no messages yet — say so + // explicitly (like Marmot groups) instead of an empty second line. + stringRes(R.string.relay_group_no_messages_yet) } ChannelName( diff --git a/amethyst/src/main/res/values/strings.xml b/amethyst/src/main/res/values/strings.xml index 812814c060..c34220af72 100644 --- a/amethyst/src/main/res/values/strings.xml +++ b/amethyst/src/main/res/values/strings.xml @@ -2007,6 +2007,7 @@ Browse Relays you\'re on Popular relays + No messages yet Join this group to send messages. This group is invite-only — you need an invite to post. diff --git a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip29RelayGroups/RelayGroupChannelTest.kt b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip29RelayGroups/RelayGroupChannelTest.kt index d8a56e5a27..d346cfaabf 100644 --- a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip29RelayGroups/RelayGroupChannelTest.kt +++ b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip29RelayGroups/RelayGroupChannelTest.kt @@ -79,6 +79,20 @@ class RelayGroupChannelTest { return EventFactory.create("00".repeat(32), relaySelf, createdAt, GroupAdminsEvent.KIND, tags, "", "22".repeat(64)) as GroupAdminsEvent } + @Test + fun placeholderNoteCarriesChannelGathererAndIsStable() { + val c = channel() + val note = c.placeholderNote() + + // Stable, group-derived id and — crucially — the channel is registered as a gatherer so the + // Messages row renderer (ChatroomHeaderCompose) resolves the event-less note back to the + // group instead of blanking it. + assertEquals("relaygroup-empty-${c.groupId.toKey()}", note.idHex) + assertTrue(note.inGatherers?.any { it === c } == true) + // Cached: same instance on repeat so equality-based feed diffing keeps one stable row. + assertTrue(c.placeholderNote() === note) + } + @Test fun membershipFromRolesAndMembers() { val c = channel()