Bubble [main]

Improved structure and formatting of a comment page

=> cdc567ae5dc7075c5179700e4ab4b7c7de109f59

diff --git a/feeds.py b/feeds.py
index 9cf6e82..1b823ce 100644
--- a/feeds.py
+++ b/feeds.py
@@ -254,10 +254,11 @@ def make_post_page(session, post):
         last_age = focused_cmt.age()
         post_id = post.parent
         post = db.get_post(id=post_id)
+        page += f'# Comment by {focused_cmt.poster_avatar} {focused_cmt.poster_name}\n\n'
         if post:
             page += f'=> {post.page_url()} Re: "{post.title if post.title else shorten_text(strip_links(clean_title(post.summary)), 60)}"\n'
             sub_name = ("u/" if post.sub_owner else "s/") + post.sub_name
-            page += f'=> /{sub_name} Comment in: {sub_name}\n\n'
+            page += f'=> /{sub_name} In: {sub_name}\n\n'
         else:
             if not session.user or session.user.id != focused_cmt.user:
                 # Can't view others' comments on deleted posts, just your own.
@@ -273,19 +274,22 @@ def make_post_page(session, post):
             if post:
                 if session.is_editable(focused_cmt):
                     actions.append(f'=> /edit/{focused_cmt.id} ✏️ Edit comment\n')
-                if post and session.user and not session.is_context_locked and display_order_desc and \
+                elif session.is_deletable(focused_cmt):
+                    actions.append(f'=> /edit/{focused_cmt.id}/delete/{session.get_token()} ❌ Delete comment\n')
+                if post and session.user and not session.is_context_locked and \
                         session.user.role != User.LIMITED:
-                    actions.append(f'=> /comment/{post.id} 💬 Comment\n')
+                    actions.append(f'=> /comment/{post.id} 💬 Add comment\n')
                 if session.is_thanks_enabled() and focused_cmt.user != user.id:
                     actions.append(f'=> /thanks/{focused_cmt.id} 🙏 Give thanks\n')
-            if session.is_deletable(focused_cmt) and (not session.is_editable(focused_cmt) or not post):
-                actions.append(f'=> /edit/{focused_cmt.id}/delete/{session.get_token()} ❌ Delete comment\n')
+            else:
+                if session.is_deletable(focused_cmt): # and (not session.is_editable(focused_cmt) or not post):
+                    actions.append(f'=> /edit/{focused_cmt.id}/delete/{session.get_token()} ❌ Delete comment\n')
             if actions:
                 page += '\n## Actions\n' + ''.join(actions)
             page += '\n' + session.dashboard_link()
 
         if post:
-            op_section = '\n## Original Post\n\n' + session.feed_entry(post)
+            op_section = '\n# Original Post\n\n' + session.feed_entry(post)
         else:
             op_section = ''
 
@@ -450,8 +454,11 @@ def make_post_page(session, post):
             comments = list(filter(lambda p: p.id != focused_cmt.id and p.user == focused_cmt.user,
                                    comments))
 
+    have_other_comments = False
     n = len(comments)
+
     if n > 0 or commits or incoming_xrefs:
+        have_other_comments = True
         if n > 1:
             dir_icon = ' ↑' if display_order_desc else ' ↓'
         else:
@@ -523,7 +530,8 @@ def make_post_page(session, post):
             page += '\n' + rendered
 
     # Show the Comment action at the appropriate place wrt reading direction.
-    if (session.user
+    if (have_other_comments
+        and session.user
         and session.user.role != User.LIMITED
         and post
         and not session.is_context_locked
Proxy Information
Original URL
gemini://git.skyjake.fi/bubble/main/cdiff/cdc567ae5dc7075c5179700e4ab4b7c7de109f59
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
26.067457 milliseconds
Gemini-to-HTML Time
0.808075 milliseconds

This content has been proxied by September (ba2dc).