1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-22 16:17:29 +00:00

Show followers not available message instead of 0

This commit is contained in:
Cadence Ember 2020-04-20 19:51:53 +12:00
parent a45142a02d
commit 69585a18ec
No known key found for this signature in database
GPG Key ID: 128B99B1B74A6412
3 changed files with 17 additions and 10 deletions

View File

@ -68,8 +68,9 @@ module.exports = [
if (typeof page === "number" && !isNaN(page) && page >= 1) {
await user.timeline.fetchUpToPage(page - 1)
}
const followerCountsAvailable = !(user.constructor.name === "ReelUser" && user.following === 0 && user.followedBy === 0)
const {website_origin, settings: {display_feed_validation_buttons}} = constants
return render(200, "pug/user.pug", {url, user, constants, website_origin, display_feed_validation_buttons})
return render(200, "pug/user.pug", {url, user, followerCountsAvailable, constants, website_origin, display_feed_validation_buttons})
}).catch(error => {
if (error === constants.symbols.NOT_FOUND || error === constants.symbols.ENDPOINT_OVERRIDDEN) {
return render(404, "pug/friendlyerror.pug", {

View File

@ -1,4 +1,4 @@
//- Needs user, url, constants, website_origin, display_feed_validation_buttons
//- Needs user, followerCountsAvailable, url, constants, website_origin, display_feed_validation_buttons
include includes/timeline_page.pug
include includes/next_page_button.pug
@ -50,10 +50,13 @@ html
a(href=user.data.external_url)= user.data.external_url
if user.posts != undefined
div.profile-counter #[span(data-numberformat=user.posts).count #{numberFormat(user.posts)}] posts
if followerCountsAvailable
if user.following != undefined
div.profile-counter #[span(data-numberformat=user.following).count #{numberFormat(user.following)}] following
if user.followedBy != undefined
div.profile-counter #[span(data-numberformat=user.followedBy).count #{numberFormat(user.followedBy)}] followed by
else
div.profile-counter.not-available Followers not available.
div.links
if constants.settings.rss_enabled
+feed_link("RSS", "rss", user.data.username, "application/rss+xml", display_feed_validation_buttons)

View File

@ -87,20 +87,26 @@ body
font-weight: normal
.bio
margin: 20px 0px
unicode-bidi: plaintext
.profile-counter
line-height: 1.3
&.not-available
font-style: italic
.count
font-weight: bold
.website
margin: 20px 0px
a, a:visited
color: $main-theme-link-color
.links
margin-top: 20px
margin: 15px 0px
display: flex
flex-wrap: wrap
justify-content: center
@ -114,9 +120,6 @@ body
> *
margin: 5px
> *:last-child
margin-bottom: 10px // because padding-bottom on parent doesn't seem to work.
.timeline
--image-size: 260px
$image-size: var(--image-size)