use forum post redirection in recent and team posts

This commit is contained in:
Thibault Duplessis 2013-05-30 12:12:47 +02:00
parent e44e142bc5
commit b635bb320a
5 changed files with 6 additions and 11 deletions

View file

@ -1,10 +1,8 @@
@(posts: List[lila.forum.PostLiteView])(implicit ctx: Context)
@posts.reverse.map { v =>
@defining(routes.ForumTopic.show(v.topic.categId, v.topic.slug, v.topicLastPage) + "#" + v.post.number) { postUrl =>
<li @v.post.isTeam.fold("class='s16 team'", "")>
<a class="post_link" href="@postUrl">@v.topic.name</a>
<span>@authorLink(v.post, withOnline = false)</span>
@shorten(v.post.text, 50)
<a class="post_link" href="@routes.ForumPost.redirect(v.post.id)">@v.topic.name</a>
<span>@authorLink(v.post, withOnline = false)</span>
@shorten(v.post.text, 50)
</li>
}
}

View file

@ -46,17 +46,15 @@
<h2><a href="@teamForumUrl(t.id)">@trans.forum() (@info.forumNbPosts)</a></h2>
<ol class="posts">
@info.forumPosts.take(10).map { v =>
@defining(routes.ForumTopic.show(v.topic.categId, v.topic.slug, v.topicLastPage) + "#" + v.post.number) { postUrl =>
<li>
<p class="meta clearfix">
<a href="@postUrl">@v.topic.name</a>
<a href="@routes.ForumPost.redirect(v.post.id)">@v.topic.name</a>
@authorLink(v.post, withOnline = false)
@timeago(v.post.createdAt)
</p>
<p>@shorten(v.post.text, 200)</p>
</li>
}
}
</ol>
<a class="more" href="@teamForumUrl(t.id)">@t.name @trans.forum() »</a>
<div class="actions">

View file

@ -80,7 +80,7 @@ final class PostApi(
topics $find.byIds[Topic](posts.map(_.topicId).distinct)
} yield posts map { post
topics find (_.id == post.topicId) map { topic
PostLiteView(post, topic, lastPageOf(topic))
PostLiteView(post, topic)
}
} flatten

View file

@ -41,6 +41,6 @@ case class PostView(
def show = post.showUserIdOrAuthor + " @ " + topic.name + " - " + post.text.take(80)
}
case class PostLiteView(post: Post, topic: Topic, topicLastPage: Int)
case class PostLiteView(post: Post, topic: Topic)
case class PostUrlData(categ: String, topic: String, page: Int, number: Int)

1
todo
View file

@ -71,7 +71,6 @@ check team average elo http://en.lichess.org/inbox/benuegti#bottom
if game ends during move -> bug
search bug http://fr.lichess.org/forum/search?text=user:aybabtu
LilaError['[analysis] fred65 already analyses ueogn4fr, won't process ueogn4fr']
recent posts should use post redirect
---