From 57611f41296640cabfdd1e674f01b2efe657b3e5 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Mon, 22 May 2023 00:07:37 +0300

Subject: [PATCH 1/1] Edit segments via a raw content mode (special command

\e)

IssueID #61


50_bubble.py | 11 ++++++++++-

composer.py | 25 +++++++++++++++++++------

2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/50_bubble.py b/50_bubble.py

index d6a25a7..815cfef 100644

--- a/50_bubble.py

+++ b/50_bubble.py

@@ -387,6 +387,14 @@ In the "New post" and "Comment" prompts, there are special commands available:

+In the "Edit text" prompts of the draft composer:

+* Entering \e will open the text segment in a raw view so that it can be edited via Titan directly, if the client supports page editing.

+### Undoing Mistakes

+When editing segments in the draft composer, you may sometimes accidentally submit the input and overwrite the contents, losing some text that you meant to keep in there. While Bubble does not currently keep a history of past edited versions, your client may be able to help you. If you navigate backwards, the old contents of the segment may be found in a cached copy of the page.

"""

         return page

@@ -407,7 +415,8 @@ when the administrator assigns at least one moderator to it.

         return admin_actions(session)

     elif req.path.startswith(self.path + 'edit-segment/') or \

         return edit_segment(session)

     elif req.path.startswith(self.path + 'edit/'):

diff --git a/composer.py b/composer.py

index 6f7390c..90db7eb 100644

--- a/composer.py

+++ b/composer.py

@@ -10,15 +10,15 @@ def edit_segment(session):

 db = session.db

 req = session.req

 seg_action = found.group(1)

 seg_id = int(found.group(2))

 segment = db.get_segment(seg_id)

 if not segment:

     return 51, 'Not found'

         if segment.type == Segment.LINK:

             return 10, 'Edit link: (URL followed by label, separated with space)'

         if segment.type == Segment.POLL:

@@ -27,15 +27,26 @@ def edit_segment(session):

         if segment.type == Segment.POLL:

             return 10, 'Move to which position in the poll: (X to remove)'

 post = db.get_post(segment.post)

 if not session.is_editable(post):

     return 61, 'Cannot edit posts by other users'

     if segment.type == Segment.LINK:

         seg_url, seg_text = parse_link_segment_query(req)

         db.update_segment(segment, url=seg_url, content=seg_text)

@@ -43,6 +54,8 @@ def edit_segment(session):

     elif segment.type == Segment.TEXT:

         if session.is_gemini:

             seg_text = clean_query(req)

         else:

             seg_text = clean_text(req.content.decode('utf-8'))

         db.update_segment(segment, content=seg_text)

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/bubble/main/patch/57611f41296640cabfdd1e674f01b2efe657b3e5.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
28.610761 milliseconds
Gemini-to-HTML Time
2.096817 milliseconds

This content has been proxied by September (3851b).