1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-15 20:57: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) { if (typeof page === "number" && !isNaN(page) && page >= 1) {
await user.timeline.fetchUpToPage(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 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 => { }).catch(error => {
if (error === constants.symbols.NOT_FOUND || error === constants.symbols.ENDPOINT_OVERRIDDEN) { if (error === constants.symbols.NOT_FOUND || error === constants.symbols.ENDPOINT_OVERRIDDEN) {
return render(404, "pug/friendlyerror.pug", { 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/timeline_page.pug
include includes/next_page_button.pug include includes/next_page_button.pug
@ -50,10 +50,13 @@ html
a(href=user.data.external_url)= user.data.external_url a(href=user.data.external_url)= user.data.external_url
if user.posts != undefined if user.posts != undefined
div.profile-counter #[span(data-numberformat=user.posts).count #{numberFormat(user.posts)}] posts div.profile-counter #[span(data-numberformat=user.posts).count #{numberFormat(user.posts)}] posts
if user.following != undefined if followerCountsAvailable
div.profile-counter #[span(data-numberformat=user.following).count #{numberFormat(user.following)}] following if user.following != undefined
if user.followedBy != undefined div.profile-counter #[span(data-numberformat=user.following).count #{numberFormat(user.following)}] following
div.profile-counter #[span(data-numberformat=user.followedBy).count #{numberFormat(user.followedBy)}] followed by 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 div.links
if constants.settings.rss_enabled if constants.settings.rss_enabled
+feed_link("RSS", "rss", user.data.username, "application/rss+xml", display_feed_validation_buttons) +feed_link("RSS", "rss", user.data.username, "application/rss+xml", display_feed_validation_buttons)

View File

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