Skip to content

Commit

Permalink
Merge pull request #565 from SpongePowered/fix/null-userprojects-api
Browse files Browse the repository at this point in the history
Fix null object when a user doesn't have any projects Fixes #561
  • Loading branch information
phase authored Jul 12, 2018
2 parents bf803a1 + 028222e commit 306bedb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/ore/rest/OreRestfulApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,15 @@ trait OreRestfulApi {
jsonProjects <- writeProjects(allProjects)
} yield {
val projectsByUser = jsonProjects.groupBy(_._1.ownerId).mapValues(_.map(_._2))
userList.map { case user =>
userList.map { user =>
obj(
"id" -> user.id,
"createdAt" -> user.createdAt.get.toString,
"username" -> user.username,
"roles" -> user.globalRoles.map(_.title),
"starred" -> toJson(stars.getOrElse(user.id.get, Seq.empty)),
"avatarUrl" -> user.avatarUrl,
"projects" -> toJson(projectsByUser.get(user.id.get))
"projects" -> toJson(projectsByUser.getOrElse(user.id.get, Nil))
)
}
}
Expand Down

0 comments on commit 306bedb

Please sign in to comment.