mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
client/pools: use cheaper pool post listing for unprivileged users
This commit is contained in:
@ -14,7 +14,6 @@ const EmptyView = require("../views/empty_view.js");
|
||||
const fields = [
|
||||
"id",
|
||||
"names",
|
||||
"posts",
|
||||
"creationTime",
|
||||
"postCount",
|
||||
"category",
|
||||
@ -101,11 +100,13 @@ class PoolListController {
|
||||
return uri.formatClientLink("pools", parameters);
|
||||
},
|
||||
requestPage: (offset, limit) => {
|
||||
const canEditPosts = api.hasPrivilege("pools:edit") || api.hasPrivilege("pools:edit:posts");
|
||||
const effectiveFields = fields.concat([canEditPosts ? "posts": "postsMicro"]);
|
||||
return PoolList.search(
|
||||
this._ctx.parameters.query,
|
||||
offset,
|
||||
limit,
|
||||
fields
|
||||
effectiveFields
|
||||
);
|
||||
},
|
||||
pageRenderer: (pageCtx) => {
|
||||
|
@ -36,7 +36,7 @@ class Pool extends events.EventTarget {
|
||||
}
|
||||
|
||||
get posts() {
|
||||
return this._posts;
|
||||
return this._postsMicro || this._posts;
|
||||
}
|
||||
|
||||
get postCount() {
|
||||
@ -185,6 +185,7 @@ class Pool extends events.EventTarget {
|
||||
_creationTime: response.creationTime,
|
||||
_lastEditTime: response.lastEditTime,
|
||||
_postCount: response.postCount || 0,
|
||||
_postsMicro: response.postsMicro,
|
||||
_firstPost: response.firstPost || null,
|
||||
_lastPost: response.lastPost || null,
|
||||
_previousPost: response.previousPost || null,
|
||||
@ -192,7 +193,7 @@ class Pool extends events.EventTarget {
|
||||
};
|
||||
|
||||
for (let obj of [this, this._orig]) {
|
||||
obj._posts.sync(response.posts);
|
||||
obj._posts.sync(response.posts || []);
|
||||
}
|
||||
|
||||
Object.assign(this, map);
|
||||
|
Reference in New Issue
Block a user