Skip to content

Commit

Permalink
Fix Type Mismatch Error
Browse files Browse the repository at this point in the history
```
[error] -- [E007] Type Mismatch Error: /home/runner/work/lila/lila/app/controllers/TeamApi.scala:78:49
[error] 78 |        ids   <- api.joinedTeamIdsOfUserAsSeenBy(username)
[error]    |                                                 ^^^^^^^^
[error]    |                                 Found:    (username : lila.app.UserStr)
[error]    |                                 Required: lila.team.User
```
  • Loading branch information
fitztrev authored and schlawg committed Nov 8, 2024
1 parent a8d3826 commit aa89801
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/controllers/TeamApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ final class TeamApi(env: Env, apiC: => Api) extends LilaController(env):
yield leads

def teamsOf(username: UserStr) = AnonOrScoped(): ctx ?=>
import env.team.jsonView.given
JsonOk:
for
ids <- api.joinedTeamIdsOfUserAsSeenBy(username)
teams <- api.teamsByIds(ids)
teams <- env.team.memberRepo.addPublicLeaderIds(teams)
_ <- env.user.lightUserApi.preloadMany(teams.flatMap(_.publicLeaders))
yield teams
Found(meOrFetch(username)): user =>
import env.team.jsonView.given
JsonOk:
for
ids <- api.joinedTeamIdsOfUserAsSeenBy(user)
teams <- api.teamsByIds(ids)
teams <- env.team.memberRepo.addPublicLeaderIds(teams)
_ <- env.user.lightUserApi.preloadMany(teams.flatMap(_.publicLeaders))
yield teams

def requests(teamId: TeamId) = Scoped(_.Team.Read) { ctx ?=> me ?=>
WithOwnedTeamEnabled(teamId, _.Request): team =>
Expand Down

0 comments on commit aa89801

Please sign in to comment.