Compare commits

...

2 Commits

Author SHA1 Message Date
Jaakko Keränen f07c6b6b34
Empty feed improvements
New placeholder text with helpful tips. Appearance of empty feeds
depends on whether there is a logged-in user and which feed mode
is active.

IssueID #119
IssueID #120
2024-04-08 13:21:18 +03:00
Jaakko Keränen 736866d509
Added Gemstone avatar
IssueID #9
2024-04-08 13:20:16 +03:00
3 changed files with 37 additions and 26 deletions

View File

@ -18,7 +18,7 @@ from utils import *
from worker import *
__version__ = '8.5'
__version__ = '8.6'
class Bubble:
@ -102,7 +102,14 @@ Bubble is a Gemini bulletin board system with many influences from station.marti
Bubble is open source:
=> gemini://git.skyjake.fi/bubble/main/ Bubble Git Repository
"""
self.EMPTY_FEED_PLACEHOLDER = "Emptiness is a boundless canvas, an unconstrained beginning: an opportunity for the courageous to create and the curious to explore."
self.EMPTY_FEED_PLACEHOLDER = """## Tips for Getting Started
* Regular Gemtext syntax can be used in posts and comments, e.g., `=>` for links.
* You can edit posted comments using the Actions menu on the comment page. You can get there by opening the comment author/timestamp link or via a notification.
* You can add text to an existing post or comment to make it as long as you want.
* If you run out of space while typing a comment, end it with a backslash and the entered text becomes a draft comment. You can publish the comment after you've added all the needed text.
* In the draft composer, you must first preview a post/comment before publishing it. The preview shows how a post appears as a feed entry and as a full page.
* Try different sorting modes to see activity in older posts. For example, "Sort by activity" in the Options menu in the bottom of a feed."""
self.bubble = bubble
self.path = bubble.path

View File

@ -874,17 +874,6 @@ def make_feed_page(session):
else:
page_title = 'Followed'
if is_bubble_feed:
if is_issue_tracker:
title_count = f'{num_total} '
else:
title_count = ''
page += f'\n## {title_count}{page_title}{sort_mode}{filter_mode}\n\n'
elif is_tinylog:
page += f'author: @{c_user.name}@{session.bubble.hostname}\n'
page += f'avatar: {c_user.avatar}\n\n'
posts = db.get_posts(subspace=context,
comment=None if is_flat_feed else False,
draft=False,
@ -900,15 +889,27 @@ def make_feed_page(session):
rotate_per_day=rotate_per_day,
limit=page_size,
page=page_index)
is_empty_feed = len(posts) == 0
if len(posts) == 0 and page_index == 0:
if is_bubble_feed and (is_issue_tracker or not is_empty_feed):
if is_issue_tracker:
title_count = f'{num_total} '
else:
title_count = ''
page += f'\n## {title_count}{page_title}{sort_mode}{filter_mode}\n\n'
elif is_tinylog:
page += f'author: @{c_user.name}@{session.bubble.hostname}\n'
page += f'avatar: {c_user.avatar}\n\n'
if is_empty_feed and page_index == 0:
if is_issue_tracker:
if session.feed_mode == 'open':
page += "All clear! "
page += "There are no issues.\n\n"
else:
page += "There are no posts.\n\n\n" + \
f"> {session.EMPTY_FEED_PLACEHOLDER}\n\n\n"
elif is_bubble_feed:
#page += "There are no posts.\n"
if user:
page += f"\n{session.EMPTY_FEED_PLACEHOLDER}\n\n"
elif is_gemini_feed:
for post in posts:
page += session.gemini_feed_entry(post, context)
@ -951,13 +952,14 @@ def make_feed_page(session):
<updated>{atom_timestamp(ts_last_updated if ts_last_updated else time.time())}</updated>
<generator uri="https://gmi.skyjake.fi/bubble/" version="{session.bubble.version}">Bubble</generator>
"""
atom_footer = "\n</feed>"
atom_footer = "\n</feed>\n"
return 20, 'application/atom+xml', atom_header + page + atom_footer
elif not is_tinylog:
if not is_gemini_feed:
page += "## Options\n"
if not is_flat_feed:
if user or not is_empty_feed:
page += "## Options\n"
if not is_flat_feed and not is_empty_feed:
if feed_sort_mode != Post.SORT_CREATED:
page += "=> ?sort=new 🕑 Sort by most recent\n"
if feed_sort_mode != Post.SORT_ACTIVE:
@ -969,13 +971,14 @@ def make_feed_page(session):
page += '=> /all All Posts\n'
else:
page += '=> /followed Followed\n'
page += "=> ?feed Gemini feed\n"
page += "=> ?atom Atom feed\n"
if c_user:
page += "=> ?tinylog Tinylog\n"
if not is_empty_feed:
page += "=> ?feed Gemini feed\n"
page += "=> ?atom Atom feed\n"
if c_user:
page += "=> ?tinylog Tinylog\n"
if user:
# Search.
if not is_issue_tracker:
if not is_issue_tracker and not is_empty_feed:
if context:
page += f'=> /{context.title()}/search 🔍 Search in {context.title()}\n'
page += f'=> /{context.title()}/tag 🏷️ Tags\n'
@ -989,7 +992,7 @@ def make_feed_page(session):
page += f'=> /settings/flair/{c_user.name} 📛 Flairs on {c_user.name}\n'
if context and (not c_user or user.id == c_user.id):
page += f'=> /settings/flair/{user.name}/add/-/{context.name} 📛 Set subspace flair\n'
if session.is_user_mod:
if session.is_user_mod and not c_user:
page += f'=> /{context.title()}/admin 🌒 Subspace admin\n'
page += '\n'

View File

@ -351,6 +351,7 @@ def make_settings_page(session):
('⛱️', 'beach umbrella'),
'Miscellaneous',
('💎', 'gemstone'),
('👺', 'goblin'),
('☯️', 'yin yang'),
]