From a07ebc6e127e31d58a494e172de0e72cf078eabe Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Mon, 22 Sep 2025 14:20:59 +0100 Subject: [PATCH] Update addFollowSet() method to optionally create a list with first member. --- .../ui/screen/loggedIn/lists/NostrUserListFeedViewModel.kt | 2 ++ .../quartz/nip51Lists/peopleList/PeopleListEvent.kt | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/NostrUserListFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/NostrUserListFeedViewModel.kt index 5f8809050..633b35126 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/NostrUserListFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/NostrUserListFeedViewModel.kt @@ -118,6 +118,7 @@ class NostrUserListFeedViewModel( setName: String, setDescription: String?, isListPrivate: Boolean, + optionalFirstMemberHex: String? = null, account: Account, ) { if (!account.settings.isWriteable()) { @@ -129,6 +130,7 @@ class NostrUserListFeedViewModel( title = setName, description = setDescription, isPrivate = isListPrivate, + firstMemberHex = optionalFirstMemberHex, signer = account.signer, ) { account.sendMyPublicAndPrivateOutbox(it) diff --git a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/PeopleListEvent.kt b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/PeopleListEvent.kt index 166aefcaa..37b66c75e 100644 --- a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/PeopleListEvent.kt +++ b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/PeopleListEvent.kt @@ -219,6 +219,7 @@ class PeopleListEvent( title: String, description: String? = null, isPrivate: Boolean, + firstMemberHex: String? = null, signer: NostrSigner, createdAt: Long = TimeUtils.now(), onReady: (PeopleListEvent) -> Unit, @@ -227,7 +228,7 @@ class PeopleListEvent( val newList = create( name = title, - person = UserTag(pubKey = signer.pubKey), + person = UserTag(pubKey = firstMemberHex ?: signer.pubKey), isPrivate = isPrivate, signer = signer, dTag = dTag, @@ -239,7 +240,7 @@ class PeopleListEvent( val event = build( name = title, - privatePeople = listOf(UserTag(pubKey = signer.pubKey)), + privatePeople = listOf(UserTag(pubKey = firstMemberHex ?: signer.pubKey)), signer = signer, dTag = dTag, createdAt = createdAt, @@ -252,7 +253,7 @@ class PeopleListEvent( val event = build( name = title, - publicPeople = listOf(UserTag(pubKey = signer.pubKey)), + publicPeople = listOf(UserTag(pubKey = firstMemberHex ?: signer.pubKey)), signer = signer, dTag = dTag, createdAt = createdAt,