Skip to content

Commit

Permalink
Fix GetUser in daml script to populate the party participant map (#19786
Browse files Browse the repository at this point in the history
)
  • Loading branch information
samuel-williams-da authored Aug 14, 2024
1 parent 4acbf16 commit c62dc41
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,17 @@ object ScriptF {
for {
client <- Converter.toFuture(env.clients.getParticipant(participant))
user <- client.getUser(userId)
user <- Converter.toFuture(
userValue <- Converter.toFuture(
Converter.fromOptional(user, Converter.fromUser(env.scriptIds, _))
)
} yield SEAppAtomic(SEValue(continue), Array(SEValue(user)))
} yield {
(participant, user.flatMap(_.primaryParty)) match {
case (Some(participant), Some(party)) =>
env.addPartyParticipantMapping(party, participant)
case _ =>
}
SEAppAtomic(SEValue(continue), Array(SEValue(userValue)))
}
}

final case class DeleteUser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,17 @@ object ScriptF {
for {
client <- Converter.toFuture(env.clients.getParticipant(participant))
user <- client.getUser(userId)
user <- Converter.toFuture(
userValue <- Converter.toFuture(
Converter.fromOptional(user, Converter.fromUser(env.scriptIds, _))
)
} yield SEValue(user)
} yield {
(participant, user.flatMap(_.primaryParty)) match {
case (Some(participant), Some(party)) =>
env.addPartyParticipantMapping(party, participant)
case _ =>
}
SEValue(userValue)
}
}

final case class DeleteUser(
Expand Down

0 comments on commit c62dc41

Please sign in to comment.