Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/ublog/src/main/UblogApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ final class UblogApi(
def latestPosts(blogId: UblogBlog.Id, nb: Int): Fu[List[UblogPost.PreviewPost]] =
colls.post
.find($doc("blog" -> blogId, "live" -> true), previewPostProjection.some)
.sort($doc("sticky" -> -1, "lived.at" -> -1))
.sort(userLiveSort)
.cursor[UblogPost.PreviewPost](ReadPref.sec)
.list(nb)

Expand Down
2 changes: 2 additions & 0 deletions modules/ublog/src/main/UblogBsonHandlers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ private object UblogBsonHandlers:
"topics" -> true,
"sticky" -> true
)

val userLiveSort = $doc("sticky" -> -1, "lived.at" -> -1)
2 changes: 1 addition & 1 deletion modules/ublog/src/main/UblogPaginator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class UblogPaginator(
collection = colls.post,
selector = $doc("blog" -> blog, "live" -> live),
projection = previewPostProjection.some,
sort = if live then $doc("lived.at" -> -1) else $doc("created.at" -> -1),
sort = if live then userLiveSort else $doc("created.at" -> -1),
_.sec
),
currentPage = page,
Expand Down
2 changes: 1 addition & 1 deletion translation/source/ublog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<string name="publishOnYourBlog">Publish on your blog</string>
<string name="publishHelp">If checked, the post will be listed on your blog. If not, it will be private, in your draft posts</string>
<string name="stickyPost" comment="Label for the toggle that can make this blog post sticky.">Sticky post</string>
<string name="stickyPostHelp">If checked, this post will be listed first in your profile recent posts.</string>
<string name="stickyPostHelp">If checked, this post will be listed first in your profile recent posts and on your blog.</string>
<plurals name="publishedNbBlogPosts">
<item quantity="one">Published a blog post</item>
<item quantity="other">Published %s blog posts</item>
Expand Down
2 changes: 1 addition & 1 deletion ui/@types/lichess/i18n.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5457,7 +5457,7 @@ interface I18n {
selectPostTopics: string;
/** Sticky post */
stickyPost: string;
/** If checked, this post will be listed first in your profile recent posts. */
/** If checked, this post will be listed first in your profile recent posts and on your blog. */
stickyPostHelp: string;
/** This is a draft */
thisIsADraft: string;
Expand Down
Loading