Implement post editing functionality for Mastodon

Add ability to edit posts in Mastodon with full support for:
- Editing post text and content warnings
- Re-uploading or keeping existing media attachments
- Editing poll options (for posts with polls)
- Modifying visibility and language settings
- All features available through web interface

Changes:
- Add edit_post() method in Mastodon session to handle API calls
- Create editPost dialog class that loads existing post data
- Add edit_status() method to buffer controllers
- Add Edit menu item to base and notification menus
- Register edit_post action in all keymaps (no default key assigned)
- Add edit_post() action handler in main controller

The edit option is only enabled for the user's own posts (not boosts).
Users can access the feature through the context menu or by assigning
a keyboard shortcut in the keymap editor.
This commit is contained in:
Claude
2025-11-06 14:37:12 +00:00
parent cbafb7da69
commit 977de1332a
11 changed files with 121 additions and 0 deletions

View File

@@ -161,6 +161,13 @@ class NotificationsBuffer(BaseBuffer):
menu = menus.notification(notification.type)
if self.is_post():
widgetUtils.connect_event(menu, widgetUtils.MENU, self.reply, menuitem=menu.reply)
# Enable/disable edit based on whether the post belongs to the user
if hasattr(menu, 'edit'):
status = self.get_post()
if status and status.account.id == self.session.db["user_id"] and status.reblog == None:
widgetUtils.connect_event(menu, widgetUtils.MENU, self.edit_status, menuitem=menu.edit)
else:
menu.edit.Enable(False)
widgetUtils.connect_event(menu, widgetUtils.MENU, self.user_actions, menuitem=menu.userActions)
if self.can_share() == True:
widgetUtils.connect_event(menu, widgetUtils.MENU, self.share_item, menuitem=menu.boost)