show other users notes in mod view - closes #3332
This commit is contained in:
parent
9a8eed967c
commit
0a82d9c34d
|
@ -248,14 +248,14 @@ object User extends LilaController {
|
||||||
Env.plan.api.recentChargesOf(user) zip
|
Env.plan.api.recentChargesOf(user) zip
|
||||||
Env.report.api.byAndAbout(user, 20) zip
|
Env.report.api.byAndAbout(user, 20) zip
|
||||||
Env.pref.api.getPref(user) zip
|
Env.pref.api.getPref(user) zip
|
||||||
Env.irwin.api.status(user) zip
|
Env.irwin.api.status(user) flatMap {
|
||||||
Env.user.noteApi.forMod(user.id) flatMap {
|
case emails ~ spy ~ assess ~ history ~ charges ~ reports ~ pref ~ irwin =>
|
||||||
case emails ~ spy ~ assess ~ history ~ charges ~ reports ~ pref ~ irwin ~ notes =>
|
|
||||||
(Env.playban.api bans spy.usersSharingIp.map(_.id)) zip
|
(Env.playban.api bans spy.usersSharingIp.map(_.id)) zip
|
||||||
|
Env.user.noteApi.forMod(user.id :: spy.otherUserIds) zip
|
||||||
Env.user.lightUserApi.preloadMany {
|
Env.user.lightUserApi.preloadMany {
|
||||||
reports.userIds ::: assess.??(_.games).flatMap(_.userIds)
|
reports.userIds ::: assess.??(_.games).flatMap(_.userIds)
|
||||||
} map {
|
} map {
|
||||||
case (bans, _) =>
|
case bans ~ notes ~ _ =>
|
||||||
html.user.mod(user, emails, spy, assess, bans, history, charges, reports, pref, irwin, notes)
|
html.user.mod(user, emails, spy, assess, bans, history, charges, reports, pref, irwin, notes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,9 +273,9 @@
|
||||||
</td>
|
</td>
|
||||||
<td data-sort="@o.count.game">@o.count.game.localize</td>
|
<td data-sort="@o.count.game">@o.count.game.localize</td>
|
||||||
<td class="i">
|
<td class="i">
|
||||||
@defining(notes.filter(_.to == o.id)) { notes =>
|
@defining(notes.filter(_.to == o.id)) { ns =>
|
||||||
@if(notes.nonEmpty) {
|
@if(ns.nonEmpty) {
|
||||||
<a href="@routes.User.show(o.username)?notes"><i title="Notes from @notes.map(_.from).map(usernameOrId).mkString(", ")" data-icon="m" class="is-green"></i>@notes.size</a>
|
<a href="@routes.User.show(o.username)?notes"><i title="Notes from @ns.map(_.from).map(usernameOrId).mkString(", ")" data-icon="m" class="is-green"></i>@ns.size</a>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@bans.get(o.id).map { nb => <i title="Playban" data-icon="p"></i>@nb }
|
@bans.get(o.id).map { nb => <i title="Playban" data-icon="p"></i>@nb }
|
||||||
|
|
|
@ -27,6 +27,8 @@ case class UserSpy(
|
||||||
OtherUser(_, false, true)
|
OtherUser(_, false, true)
|
||||||
}
|
}
|
||||||
}.sortBy(-_.user.createdAt.getMillis)
|
}.sortBy(-_.user.createdAt.getMillis)
|
||||||
|
|
||||||
|
def otherUserIds = otherUsers.map(_.user.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
object UserSpy {
|
object UserSpy {
|
||||||
|
|
|
@ -49,6 +49,11 @@ final class NoteApi(
|
||||||
.sort($doc("date" -> -1))
|
.sort($doc("date" -> -1))
|
||||||
.list[Note](20)
|
.list[Note](20)
|
||||||
|
|
||||||
|
def forMod(ids: List[User.ID]): Fu[List[Note]] =
|
||||||
|
coll.find($doc("to" -> $doc("$in" -> ids)))
|
||||||
|
.sort($doc("date" -> -1))
|
||||||
|
.list[Note](50)
|
||||||
|
|
||||||
def byMod(ids: List[User.ID]): Fu[List[Note]] =
|
def byMod(ids: List[User.ID]): Fu[List[Note]] =
|
||||||
coll.find($doc("to" $in ids))
|
coll.find($doc("to" $in ids))
|
||||||
.sort($doc("date" -> -1))
|
.sort($doc("date" -> -1))
|
||||||
|
|
Loading…
Reference in a new issue