Changeset 5190152 in Klonkt for src/routes


Ignore:
Timestamp:
07/19/2026 05:38:25 PM (7 weeks ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
e9c9ae1
Parents:
feced2c
git-author:
Robin <roboburr@…> (07/19/2026 05:38:00 PM)
git-committer:
Robin <roboburr@…> (07/19/2026 05:38:25 PM)
Message:

Feature: rich editor on the edit forms too (klonkt-demo-c7f, last slice)

Editing a sent reply (Messages + the interact page's manage list) now opens the
same shared editor as new replies, instead of a bare textarea. Prutter stays
plain on purpose (Robin: not part of this).

  • reply-editor partial: initialHtml/initialText prefill for edit mode, and a noAttach flag that omits the media UI (an edit never touches attachments). JS grew canAttach guards so the component runs without the attach elements; pasted files are still swallowed there rather than becoming base64 blobs.
  • deliverOutboxUpdate(site, id, text, {html, language}): rich path with the same sanitize + enrichment + mention-first-paragraph logic as deliverReply; language updated via COALESCE (bogus codes keep the old one); attachments survive untouched. Plain path unchanged.
  • /fediverse/:id/edit passes content + language; listOutbox and the Messages sent-projection carry language so the select preselects correctly.
  • The interact page's edit-toggle focuses the rich editor when present.

2 new tests (93 green). Browser-verified on /messages: prefilled editor
(mention-stripped HTML + plain fallback + language preselected, no paperclip),
edit saved -> content replaced with markup, mention re-attached inline,
language nl->en, no console errors.

Co-Authored-By: Claude Opus 4.8 <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    rfeced2c r5190152  
    827827router.post('/fediverse/:id/edit', requireSiteManager, async (req, res) => {
    828828  const site = res.locals.site;
    829   if (site && String(req.body.text || '').trim()) {
    830     try { await ActivityPubService.deliverOutboxUpdate(site, req.params.id, req.body.text); }
    831     catch (e) { console.warn('[AP] outbox edit failed:', e.message); }
     829  const text = String(req.body.text || '');
     830  const html = String(req.body.content || '');   // rich reply editor HTML (sanitized in deliverOutboxUpdate)
     831  if (site && (text.trim() || html.trim())) {
     832    try {
     833      await ActivityPubService.deliverOutboxUpdate(site, req.params.id, text, {
     834        html, language: String(req.body.language || ''),
     835      });
     836    } catch (e) { console.warn('[AP] outbox edit failed:', e.message); }
    832837  }
    833838  res.redirect(req.get('Referer') || `${res.locals.siteUrlBase || ''}/fediverse`);
Note: See TracChangeset for help on using the changeset viewer.