mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 13:47:49 +01:00
Take into account profile membership when removing profile.
This commit is contained in:
@@ -155,6 +155,31 @@ class PeopleListEvent(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun remove(
|
||||||
|
earlierVersion: PeopleListEvent,
|
||||||
|
person: UserTag,
|
||||||
|
isPrivate: Boolean,
|
||||||
|
signer: NostrSigner,
|
||||||
|
createdAt: Long = TimeUtils.now(),
|
||||||
|
): PeopleListEvent {
|
||||||
|
if (isPrivate) {
|
||||||
|
val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException()
|
||||||
|
return resign(
|
||||||
|
publicTags = earlierVersion.tags,
|
||||||
|
privateTags = privateTags.remove(person.toTagArray()),
|
||||||
|
signer = signer,
|
||||||
|
createdAt = createdAt,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return resign(
|
||||||
|
content = earlierVersion.content,
|
||||||
|
tags = earlierVersion.tags.remove(person.toTagArray()),
|
||||||
|
signer = signer,
|
||||||
|
createdAt = createdAt,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun resign(
|
suspend fun resign(
|
||||||
publicTags: TagArray,
|
publicTags: TagArray,
|
||||||
privateTags: TagArray,
|
privateTags: TagArray,
|
||||||
@@ -321,6 +346,7 @@ class PeopleListEvent(
|
|||||||
suspend fun removeUser(
|
suspend fun removeUser(
|
||||||
earlierVersion: PeopleListEvent,
|
earlierVersion: PeopleListEvent,
|
||||||
pubKeyHex: String,
|
pubKeyHex: String,
|
||||||
|
isUserPrivate: Boolean,
|
||||||
signer: NostrSigner,
|
signer: NostrSigner,
|
||||||
createdAt: Long = TimeUtils.now(),
|
createdAt: Long = TimeUtils.now(),
|
||||||
onReady: (PeopleListEvent) -> Unit,
|
onReady: (PeopleListEvent) -> Unit,
|
||||||
@@ -329,6 +355,7 @@ class PeopleListEvent(
|
|||||||
remove(
|
remove(
|
||||||
earlierVersion = earlierVersion,
|
earlierVersion = earlierVersion,
|
||||||
person = UserTag(pubKey = pubKeyHex),
|
person = UserTag(pubKey = pubKeyHex),
|
||||||
|
isPrivate = isUserPrivate,
|
||||||
signer = signer,
|
signer = signer,
|
||||||
createdAt = createdAt,
|
createdAt = createdAt,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user