Adds methods to follow a bunch of users at the same time

This commit is contained in:
Vitor Pamplona
2026-03-10 11:12:23 -04:00
parent b8f9b18506
commit ab9ecdc939
4 changed files with 42 additions and 0 deletions
@@ -123,6 +123,25 @@ class ContactListEvent(
)
}
suspend fun followUsers(
earlierVersion: ContactListEvent,
users: List<ContactTag>,
signer: NostrSigner,
createdAt: Long = TimeUtils.now(),
): ContactListEvent {
val follows = earlierVersion.verifiedFollowKeySet()
val toBeAdded = users.filter { it.pubKey !in follows }.distinctBy { it.pubKey }.map { it.toTagArray() }
if (toBeAdded.isEmpty()) return earlierVersion
return create(
content = earlierVersion.content,
tags = earlierVersion.tags + toBeAdded,
signer = signer,
createdAt = createdAt,
)
}
suspend fun unfollowUser(
earlierVersion: ContactListEvent,
pubKeyHex: String,