aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorrr-2016-10-02 17:04:56 +0200
committerrr-2016-10-02 17:07:08 +0200
commitb0c50310011eaafd55956ddea4b2d37b3556fc7e (patch)
tree24ba5b1f7d092e0e1ec256024ab1105bf4f0dcb0 /server
parent8f275206af77b4c34f58f2aca9354d36d9cfcd6a (diff)
client+server/posts: reverse next/prev post role
In the post list, when we navigate to the page with ">" button, we navigate to older posts. In the post view, when we navigate to the page with ">" button, we navigate to older posts as well. However, in the post list, the ">" button is called "next page". At the same time, in the post view, the ">" button was called "previous post". Now it's called "next post". The difference isn't visible to normal users nor even API consumers as the "get posts around post X" request isn't documented. The change is motivated not only by consistency, but to also improve compatibility with Vimperator's `[[` and `]]`. Vimperator assumes the word "next" refers to ">" and the word "previous" refers to "<".
Diffstat (limited to 'server')
-rw-r--r--server/szurubooru/search/executor.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/szurubooru/search/executor.py b/server/szurubooru/search/executor.py
index 511a9c2..39b1d56 100644
--- a/server/szurubooru/search/executor.py
+++ b/server/szurubooru/search/executor.py
@@ -41,27 +41,27 @@ class Executor(object):
filter_query, search_query, False)
prev_filter_query = (
filter_query
- .filter(self.config.id_column < entity_id)
+ .filter(self.config.id_column > entity_id)
.order_by(None)
.order_by(sqlalchemy.func.abs(
self.config.id_column - entity_id).asc())
.limit(1))
next_filter_query = (
filter_query
- .filter(self.config.id_column > entity_id)
+ .filter(self.config.id_column < entity_id)
.order_by(None)
.order_by(sqlalchemy.func.abs(
self.config.id_column - entity_id).asc())
.limit(1))
return [
- next_filter_query.one_or_none(),
- prev_filter_query.one_or_none()]
+ prev_filter_query.one_or_none(),
+ next_filter_query.one_or_none()]
def get_around_and_serialize(self, ctx, entity_id, serializer):
entities = self.get_around(ctx.get_param_as_string('query'), entity_id)
return {
- 'next': serializer(entities[0]),
- 'prev': serializer(entities[1]),
+ 'prev': serializer(entities[0]),
+ 'next': serializer(entities[1]),
}
def execute(self, query_text, page, page_size):

© 2015 - 2026 Jakob L. Kreuze