Changeset 2f50c53 in Klonkt


Ignore:
Timestamp:
07/01/2026 12:00:33 AM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
4e9782c
Parents:
366c13c
Message:

fix(cirkel): strip 'RE: <url>' quote prefix from boost card titles

A boosted plain Mastodon post with no Klonkt title fell back to the raw
text, which for a quote/reply starts with 'RE: <long-url>' (the prefix
Misskey/Akkoma and some reply federation prepend) — ugly noise in the tile
title. tidySnippet() drops a leading 'RE: <url>' and any leading bare URL
so the title shows the actual prose.

  • src/routes/circle.js — tidySnippet() applied to the card text snippet

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/circle.js

    r366c13c r2f50c53  
    3232  return String(html || '').replace(/<[^>]+>/g, ' ').replace(/&[a-z#0-9]+;/gi, ' ').replace(/\s+/g, ' ').trim();
    3333}
     34// Tidy a plain-text snippet for use as a card title: drop a leading "RE: <url>" (the
     35// quote/reply prefix Misskey/Akkoma and some reply federation prepend) and any other
     36// leading bare URL, so the title shows the actual prose, not link noise.
     37function tidySnippet(text) {
     38  return String(text || '')
     39    .replace(/^RE:\s*https?:\/\/\S+\s*/i, '')
     40    .replace(/^https?:\/\/\S+\s*/i, '')
     41    .trim();
     42}
    3443
    3544router.get('/cirkel', (req, res, next) => {
     
    3847
    3948  const posts = ActivityPubService.getCirkelPosts(site.slug, 80).map((r) => {
    40     const text = htmlToText(r.content);
     49    const text = tidySnippet(htmlToText(r.content));
    4150    // Show ONLY the title (the bold first line a Klonkt note carries), not the whole
    4251    // body. Title-less notes (e.g. plain Mastodon) fall back to a short text snippet.
Note: See TracChangeset for help on using the changeset viewer.