mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2026-03-29 15:51:35 +00:00
User pages now count for quota, as it should be.
This commit is contained in:
parent
5a1b0e88b2
commit
7acb21f613
4 changed files with 23 additions and 5 deletions
|
|
@ -13,6 +13,16 @@ function getPageTitle(post) {
|
|||
return (post.getCaptionIntroduction() || `Post from @${post.getBasicOwner().username}`) + " | Bibliogram"
|
||||
}
|
||||
|
||||
async function getUserAndQuota(req, username) {
|
||||
if (quota.remaining(req) === 0) {
|
||||
throw constants.symbols.QUOTA_REACHED
|
||||
}
|
||||
|
||||
const {user, quotaUsed} = await fetchUser(username)
|
||||
const remaining = quota.add(req, quotaUsed)
|
||||
return {user, remaining}
|
||||
}
|
||||
|
||||
function getPostAndQuota(req, shortcode) {
|
||||
if (quota.remaining(req) === 0) {
|
||||
throw constants.symbols.QUOTA_REACHED
|
||||
|
|
@ -101,8 +111,7 @@ module.exports = [
|
|||
throw constants.symbols.QUOTA_REACHED
|
||||
}
|
||||
|
||||
const {user, quotaUsed} = await fetchUser(username)
|
||||
let remaining = quota.add(req, quotaUsed)
|
||||
let {user, remaining} = await getUserAndQuota(req, username)
|
||||
|
||||
const selectedTimeline = user[type]
|
||||
let pageNumber = +params.get("page")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue