Skip to content

Commit

Permalink
Fix GetUser in daml script to populate the party participant map (#19787
Browse files Browse the repository at this point in the history
)
  • Loading branch information
samuel-williams-da authored Aug 15, 2024
1 parent 9e08ea5 commit 691e4cf
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 @@ -545,10 +545,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 @@ -626,10 +626,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 691e4cf

Please sign in to comment.