no inbox with self

This commit is contained in:
Thibault Duplessis 2020-01-27 00:45:11 -06:00
parent c64e6d247c
commit cfd1116625
2 changed files with 13 additions and 8 deletions

View file

@ -32,13 +32,18 @@ final class Msg(
env.msg.api.convoWith(me, username) flatMap { convo =>
def newJson = inboxJson(me).map { _ + ("convo" -> env.msg.json.convo(convo)) }
negotiate(
html = newJson map { json =>
Ok(views.html.msg.home(json))
},
api = v => {
if (v >= 5) newJson
else fuccess(env.msg.compat.thread(me, convo))
} map { Ok(_) }
html =
if (convo.contact.id == me.id) Redirect(routes.Msg.home).fuccess
else
newJson map { json =>
Ok(views.html.msg.home(json))
},
api = v =>
if (convo.contact.id == me.id) notFoundJson()
else {
if (v >= 5) newJson
else fuccess(env.msg.compat.thread(me, convo))
} map { Ok(_) }
)
}

View file

@ -22,7 +22,7 @@ final class MsgSearch(
.Result(
threads,
friends.filterNot(f => threads.exists(_.other(me) == f.id)) take 10,
users.filterNot(u => friends.exists(_.id == u.id)) take 10
users.filterNot(u => u.id == me.id || friends.exists(_.id == u.id)) take 10
)
}