Merge branch 'fix/v2.14.2-quotes-cleanup' for v2.14.2 release
Build Container / build (push) Successful in 9m37s

This commit is contained in:
Phil committed 2026-11-10 15:54:55 -07:00
commit 4ed2033cf9
18 files changed
+106 -60

No files matched your search

+11
View File
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [2.14.2] - 2026-11-10
### Added
- Quotes have a count in the line under each note (❝) and in the counts on the home, tag and Likes pages. It includes quotes a silo reports without names (Threads, and people who opted out of backfeed), which were stored but shown nowhere
### Removed
- The editor pages no longer load `marked` from a CDN and an empty `static/js/preview.js`; nothing used them
- The empty `templates/feed.xml`, the v1 `static/indielogin-test.html`, and the `THREADS_API` setting that crossposting read but nothing could set
## [2.14.1] - 2026-11-10 ## [2.14.1] - 2026-11-10
### Fixed ### Fixed
+1 -1
View File
@@ -266,7 +266,7 @@ tombstone, so a re-sent webmention or backfeed doesn't bring it back.
Changes that alter what is shown also re-send the note's webmentions. Changes that alter what is shown also re-send the note's webmentions.
Note pages show approved, valid responses. Under the note, a line of counts Note pages show approved, valid responses. Under the note, a line of counts
(♥ likes, 🔁 reposts, 💬 replies, bookmarks) opens a card on hover or focus (♥ likes, 🔁 reposts, 💬 replies, ❝ quotes (v2.14.2), bookmarks) opens a card on hover or focus
listing who responded and where from, including anonymous silo counts. Each listing who responded and where from, including anonymous silo counts. Each
like, repost and reply count holds an `<indie-action do with>` web action like, repost and reply count holds an `<indie-action do with>` web action
whose fallback links to the note's crossposts (v2.13.2). The Responses whose fallback links to the note's crossposts (v2.13.2). The Responses
+5 -1
View File
@@ -21,7 +21,7 @@ is in `../architecture/`; decisions are in `../decisions/` (ADRs).
## Contents ## Contents
[v0.x](#v0x) · [v1.0.0](#v100) · [v1.1.1](#v111) · [v1.1.2](#v112) · [v1.2.0](#v120) · [v1.3.0](#v130) · [v1.3.1](#v131) · [v1.4.0](#v140) · [v1.4.1](#v141) · [v1.4.2](#v142) · [v1.5.0](#v150) · [v1.6.0](#v160) · [v2.0.0](#v200) · [v2.0.1](#v201) · [v2.0.2](#v202) · [v2.1.0](#v210) · [v2.2.0](#v220) · [v2.3.0](#v230) · [v2.3.1](#v231) · [v2.3.2](#v232) · [v2.3.3](#v233) · [v2.4.0](#v240) · [v2.5.0](#v250) · [v2.6.0](#v260) · [v2.6.1](#v261) · [v2.6.2](#v262) · [v2.6.3](#v263) · [v2.6.4](#v264) · [v2.6.5](#v265) · [v2.6.6](#v266) · [v2.6.7](#v267) · [v2.6.8](#v268) · [v2.6.9](#v269) · [v2.7.0](#v270) · [v2.7.1](#v271) · [v2.7.2](#v272) · [v2.8.0](#v280) · [v2.8.1](#v281) · [v2.9.0](#v290) · [v2.10.0](#v2100) · [v2.10.1](#v2101) · [v2.10.2](#v2102) · [v2.11.0](#v2110) · [v2.12.0](#v2120) · [v2.12.1](#v2121) · [v2.13.0](#v2130) · [v2.13.1](#v2131) · [v2.13.2](#v2132) · [v2.13.3](#v2133) · [v2.13.4](#v2134) · [v2.14.0](#v2140) · [v2.14.1](#v2141) · [hotfix](#hotfix) [v0.x](#v0x) · [v1.0.0](#v100) · [v1.1.1](#v111) · [v1.1.2](#v112) · [v1.2.0](#v120) · [v1.3.0](#v130) · [v1.3.1](#v131) · [v1.4.0](#v140) · [v1.4.1](#v141) · [v1.4.2](#v142) · [v1.5.0](#v150) · [v1.6.0](#v160) · [v2.0.0](#v200) · [v2.0.1](#v201) · [v2.0.2](#v202) · [v2.1.0](#v210) · [v2.2.0](#v220) · [v2.3.0](#v230) · [v2.3.1](#v231) · [v2.3.2](#v232) · [v2.3.3](#v233) · [v2.4.0](#v240) · [v2.5.0](#v250) · [v2.6.0](#v260) · [v2.6.1](#v261) · [v2.6.2](#v262) · [v2.6.3](#v263) · [v2.6.4](#v264) · [v2.6.5](#v265) · [v2.6.6](#v266) · [v2.6.7](#v267) · [v2.6.8](#v268) · [v2.6.9](#v269) · [v2.7.0](#v270) · [v2.7.1](#v271) · [v2.7.2](#v272) · [v2.8.0](#v280) · [v2.8.1](#v281) · [v2.9.0](#v290) · [v2.10.0](#v2100) · [v2.10.1](#v2101) · [v2.10.2](#v2102) · [v2.11.0](#v2110) · [v2.12.0](#v2120) · [v2.12.1](#v2121) · [v2.13.0](#v2130) · [v2.13.1](#v2131) · [v2.13.2](#v2132) · [v2.13.3](#v2133) · [v2.13.4](#v2134) · [v2.14.0](#v2140) · [v2.14.1](#v2141) · [v2.14.2](#v2142) · [hotfix](#hotfix)
## v0.x ## v0.x
@@ -456,6 +456,10 @@ OIDC admin login and built-in IndieAuth server.
- [2026-11-10-tags-and-captions.md](v2.14.1/2026-11-10-tags-and-captions.md) — Clearing tags in the editor; captions escaped in feeds - [2026-11-10-tags-and-captions.md](v2.14.1/2026-11-10-tags-and-captions.md) — Clearing tags in the editor; captions escaped in feeds
## v2.14.2
- [2026-11-10-quotes-cleanup.md](v2.14.2/2026-11-10-quotes-cleanup.md) — Quote counts; dead files removed
## hotfix ## hotfix
Not a release folder. Not a release folder.
@@ -0,0 +1,31 @@
# v2.14.2: Quote counts; dead files removed
The two remaining items from the v2.14.0 documentation review.
## Quote counts
Backfeed stored anonymous quote counts (`syndications.quotes_count`: all
Threads quotes, and quotes by people who opted out elsewhere) that nothing
displayed. The counts line (`partials/responses.html` `reactions`) now has a
quote count after replies: named quotes plus those counts. Its card shows
only the anonymous part ("2 on Threads"); named quotes stay listed under
Responses. Quotes have no web action (there is no standard verb).
`webmention_queries.response_counts` adds `quotes`, so lists of notes show
them too.
## Removed
- `static/js/preview.js` (empty since the first commit) and the jsDelivr
`marked` script the editor pages loaded with it.
- `templates/feed.xml` (empty, never rendered) and `static/indielogin-test.html`
(a v1 IndieLogin test page).
- `syndication.get_targets()` read `THREADS_API` from the config, which
`config.py` never loads; the client now always uses the `THREADS_API`
constant.
## Verification
`tests/test_backfeed.py::test_quote_counts_include_anonymous_ones`; backfeed,
syndication, admin, template, public-route, microformats, notification,
webmention and feed tests pass. Rendered the counts line with the quote card
open in headless Chromium.
+1 -10
View File
@@ -73,16 +73,6 @@ None open.
## Low ## Low
### Quote counts without names are not shown
- **Description**: Backfeed stores anonymous quote counts (`syndications.quotes_count`: Threads quotes, and quotes by people who opted out elsewhere), but the counts line only adds likes and reposts, so these quotes are counted nowhere on the page.
- **Where**: `templates/partials/responses.html` (`reactions`), `starpunk/webmention_queries.py` (`response_counts`)
- **Source**: Documentation review 2026-11-10
### Dead files and settings
- **Description**: `static/js/preview.js` is empty, yet the editor pages load it and `marked` from jsDelivr for nothing. `templates/feed.xml` is empty and `static/indielogin-test.html` is a v1 leftover. `syndication.get_targets()` reads a `THREADS_API` setting that `config.py` never loads, so it can't be set.
- **Where**: `templates/admin/new.html`, `templates/admin/edit.html`, `static/`, `templates/feed.xml`, `starpunk/syndication.py`
- **Source**: Documentation review 2026-11-10
### Micropub: `location` / `checkin` ignored ### Micropub: `location` / `checkin` ignored
- **Description**: These properties are accepted but dropped, which spec 3.3.5 allows. - **Description**: These properties are accepted but dropped, which spec 3.3.5 allows.
- **Where**: `starpunk/micropub.py` - **Where**: `starpunk/micropub.py`
@@ -175,6 +165,7 @@ None open.
These items were removed from the backlog because they have shipped: These items were removed from the backlog because they have shipped:
- v2.14.2: quote counts (with anonymous ones) shown; dead editor scripts, files and the `THREADS_API` read removed
- v2.14.1: the editor can clear all tags; image captions escaped in RSS, Atom and JSON Feed HTML - v2.14.1: the editor can clear all tags; image captions escaped in RSS, Atom and JSON Feed HTML
- v2.14.0: notifications of new responses and crosspost/backfeed problems through Apprise (ADR-074) - v2.14.0: notifications of new responses and crosspost/backfeed problems through Apprise (ADR-074)
+1
View File
@@ -57,3 +57,4 @@ Future work and per-release plans. See `../DOCUMENTATION.md` (PROJECTPLAN).
- **[v2.13.4](v2.13.4/RELEASE.md)** - Counts on lists of notes, reply cards link out (Released 2026-11-10) - **[v2.13.4](v2.13.4/RELEASE.md)** - Counts on lists of notes, reply cards link out (Released 2026-11-10)
- **[v2.14.0](v2.14.0/RELEASE.md)** - Notifications through Apprise (Released 2026-11-10) - **[v2.14.0](v2.14.0/RELEASE.md)** - Notifications through Apprise (Released 2026-11-10)
- **[v2.14.1](v2.14.1/RELEASE.md)** - Clearing tags in the editor; captions escaped in feeds (Released 2026-11-10) - **[v2.14.1](v2.14.1/RELEASE.md)** - Clearing tags in the editor; captions escaped in feeds (Released 2026-11-10)
- **[v2.14.2](v2.14.2/RELEASE.md)** - Quote counts; dead files removed (Released 2026-11-10)
+18
View File
@@ -0,0 +1,18 @@
# v2.14.2
- **Date**: 2026-11-10
- **Status**: Released
- **Focus**: Quote counts; dead files removed
## Added
- Quote counts (with anonymous ones) in the counts line and on lists of notes
## Removed
- Unused editor scripts (`marked` from a CDN, empty `preview.js`), `templates/feed.xml`, `static/indielogin-test.html`, the `THREADS_API` config read
## Related
- [CHANGELOG](../../../CHANGELOG.md)
- [Design note](../../design/v2.14.2/2026-11-10-quotes-cleanup.md)
+2 -2
View File
@@ -465,5 +465,5 @@ def create_app(config=None):
# Package version (Semantic Versioning 2.0.0) # Package version (Semantic Versioning 2.0.0)
# See docs/standards/versioning-strategy.md for details # See docs/standards/versioning-strategy.md for details
__version__ = "2.14.1" __version__ = "2.14.2"
__version_info__ = (2, 14, 1) __version_info__ = (2, 14, 2)
+1 -2
View File
@@ -1074,8 +1074,7 @@ def get_targets() -> Dict[str, Target]:
if token: if token:
client = _client_cache.get("threads") client = _client_cache.get("threads")
if client is None or client.config_token != token: if client is None or client.config_token != token:
client = ThreadsClient(token, Path(config["DATA_PATH"]) / "threads_token.json", client = ThreadsClient(token, Path(config["DATA_PATH"]) / "threads_token.json")
api=config.get("THREADS_API") or THREADS_API)
_client_cache["threads"] = client _client_cache["threads"] = client
username = (config.get("THREADS_USERNAME") or "").lstrip("@") username = (config.get("THREADS_USERNAME") or "").lstrip("@")
targets["threads"] = Target( targets["threads"] = Target(
+8 -5
View File
@@ -112,7 +112,8 @@ def get_webmentions_for_note(note_id: int) -> Dict[str, List[Dict[str, Any]]]:
def response_counts(note_ids: List[int]) -> Dict[int, Dict[str, int]]: def response_counts(note_ids: List[int]) -> Dict[int, Dict[str, int]]:
""" """
Likes, reposts and replies per note, for lists of notes (v2.13.4). Likes, reposts, replies and quotes per note, for lists of notes
(v2.13.4; quotes v2.14.2).
Shown responses (valid and approved) plus the counts silos give without Shown responses (valid and approved) plus the counts silos give without
names (Threads; people who opted out of backfeed) on synced crossposts. names (Threads; people who opted out of backfeed) on synced crossposts.
@@ -126,21 +127,22 @@ def response_counts(note_ids: List[int]) -> Dict[int, Dict[str, int]]:
def add(note_id, key, n): def add(note_id, key, n):
if n: if n:
counts.setdefault(note_id, {'likes': 0, 'reposts': 0, 'replies': 0})[key] += n counts.setdefault(note_id, {'likes': 0, 'reposts': 0, 'replies': 0, 'quotes': 0})[key] += n
for row in db.execute( for row in db.execute(
f""" f"""
SELECT target_note_id, mention_type, COUNT(*) FROM webmentions SELECT target_note_id, mention_type, COUNT(*) FROM webmentions
WHERE target_note_id IN ({marks}) AND validation_status = 'valid' WHERE target_note_id IN ({marks}) AND validation_status = 'valid'
AND moderation_status = 'approved' AND mention_type IN ('like', 'repost', 'reply') AND moderation_status = 'approved' AND mention_type IN ('like', 'repost', 'reply', 'quote')
GROUP BY target_note_id, mention_type GROUP BY target_note_id, mention_type
""", """,
note_ids, note_ids,
): ):
add(row[0], {'like': 'likes', 'repost': 'reposts', 'reply': 'replies'}[row[1]], row[2]) add(row[0], {'like': 'likes', 'repost': 'reposts', 'reply': 'replies', 'quote': 'quotes'}[row[1]], row[2])
for row in db.execute( for row in db.execute(
f""" f"""
SELECT note_id, SUM(COALESCE(likes_count, 0)), SUM(COALESCE(reposts_count, 0)) SELECT note_id, SUM(COALESCE(likes_count, 0)), SUM(COALESCE(reposts_count, 0)),
SUM(COALESCE(quotes_count, 0))
FROM syndications WHERE note_id IN ({marks}) AND state = 'synced' FROM syndications WHERE note_id IN ({marks}) AND state = 'synced'
GROUP BY note_id GROUP BY note_id
""", """,
@@ -148,6 +150,7 @@ def response_counts(note_ids: List[int]) -> Dict[int, Dict[str, int]]:
): ):
add(row[0], 'likes', row[1]) add(row[0], 'likes', row[1])
add(row[0], 'reposts', row[2]) add(row[0], 'reposts', row[2])
add(row[0], 'quotes', row[3])
return counts return counts
-27
View File
@@ -1,27 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IndieLogin Test Form</title>
</head>
<body>
<h1>IndieLogin Test Form</h1>
<p>This is the exact form from IndieLogin.com API docs</p>
<form action="https://indielogin.com/authorize" method="get">
<label for="url">Web Address:</label>
<input id="url" type="text" name="me" placeholder="yourdomain.com" value="https://thesatelliteoflove.com" />
<p><button type="submit">Sign In</button></p>
<input type="hidden" name="client_id" value="https://starpunk.thesatelliteoflove.com/" />
<input type="hidden" name="redirect_uri" value="https://starpunk.thesatelliteoflove.com/auth/callback" />
<input type="hidden" name="state" value="TESTSTATE123456789" />
<input type="hidden" name="code_challenge" value="E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM" />
<input type="hidden" name="code_challenge_method" value="S256" />
</form>
<hr>
<p><strong>Note:</strong> This uses a fixed code_challenge for testing. In production, this should be generated fresh each time.</p>
<p><strong>Form will submit to:</strong> https://indielogin.com/authorize</p>
</body>
</html>
View File
Whitespace-only changes.
-5
View File
@@ -116,8 +116,3 @@
</div> </div>
{% endblock %} {% endblock %}
{% block head %}
{{ super() }}
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="{{ url_for('static', filename='js/preview.js') }}"></script>
{% endblock %}
-2
View File
@@ -88,8 +88,6 @@
{% block head %} {% block head %}
{{ super() }} {{ super() }}
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="{{ url_for('static', filename='js/preview.js') }}"></script>
<style> <style>
.media-preview { .media-preview {
View File
Whitespace-only changes.
+1 -1
View File
@@ -79,7 +79,7 @@
</footer> </footer>
<div id="responses"></div> <div id="responses"></div>
{{ responses.reactions(likes, reposts, replies, bookmarks, syndications, absolute_url_for('public.note', slug=note.slug)) }} {{ responses.reactions(likes, reposts, replies, bookmarks, syndications, absolute_url_for('public.note', slug=note.slug), quotes) }}
<nav class="note-nav"> <nav class="note-nav">
<a href="/">← All notes</a> <a href="/">← All notes</a>
+8 -4
View File
@@ -64,6 +64,7 @@
'like': '<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/></svg>', 'like': '<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/></svg>',
'repost': '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17 1l4 4-4 4"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><path d="M7 23l-4-4 4-4"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg>', 'repost': '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17 1l4 4-4 4"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><path d="M7 23l-4-4 4-4"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg>',
'reply': '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 11.5a8.4 8.4 0 0 1-9 8.4 8.6 8.6 0 0 1-3.9-.9L3 21l1.9-5.1A8.4 8.4 0 0 1 12 3.1a8.4 8.4 0 0 1 9 8.4z"/></svg>', 'reply': '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 11.5a8.4 8.4 0 0 1-9 8.4 8.6 8.6 0 0 1-3.9-.9L3 21l1.9-5.1A8.4 8.4 0 0 1 12 3.1a8.4 8.4 0 0 1 9 8.4z"/></svg>',
'quote': '<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M7.2 5C4.3 6.4 3 8.9 3 12.3V19h7v-7H6.3c.1-2.2 1-3.7 2.9-4.6L7.2 5zm10 0c-2.9 1.4-4.2 3.9-4.2 7.3V19h7v-7h-3.7c.1-2.2 1-3.7 2.9-4.6L17.2 5z"/></svg>',
'bookmark': '<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M6 2h12a1 1 0 0 1 1 1v19l-7-4-7 4V3a1 1 0 0 1 1-1z"/></svg>', 'bookmark': '<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M6 2h12a1 1 0 0 1 1 1v19l-7-4-7 4V3a1 1 0 0 1 1-1z"/></svg>',
} %} } %}
{% set VERBS = {'like': 'Like', 'repost': 'Repost', 'reply': 'Reply'} %} {% set VERBS = {'like': 'Like', 'repost': 'Repost', 'reply': 'Reply'} %}
@@ -95,19 +96,22 @@
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
{% macro reactions(likes, reposts, replies, bookmarks, syndications, permalink) %} {% macro reactions(likes, reposts, replies, bookmarks, syndications, permalink, quotes=[]) %}
{% set anon_likes, anon_reposts = [], [] %} {% set anon_likes, anon_reposts, anon_quotes = [], [], [] %}
{% for s in syndications or [] %} {% for s in syndications or [] %}
{% if s.likes_count %}{% set _ = anon_likes.append((s.name, s.likes_count)) %}{% endif %} {% if s.likes_count %}{% set _ = anon_likes.append((s.name, s.likes_count)) %}{% endif %}
{% if s.reposts_count %}{% set _ = anon_reposts.append((s.name, s.reposts_count)) %}{% endif %} {% if s.reposts_count %}{% set _ = anon_reposts.append((s.name, s.reposts_count)) %}{% endif %}
{% if s.quotes_count %}{% set _ = anon_quotes.append((s.name, s.quotes_count)) %}{% endif %}
{% endfor %} {% endfor %}
{% set copies = (syndications or [])|selectattr('remote_url')|list %} {% set copies = (syndications or [])|selectattr('remote_url')|list %}
{% if copies or likes or reposts or replies or bookmarks or anon_likes or anon_reposts %} {% if copies or likes or reposts or replies or quotes or bookmarks or anon_likes or anon_reposts or anon_quotes %}
<div class="response-counts"> <div class="response-counts">
{{ reaction('like', likes or [], 'u-like', anon_likes, 'like', 'likes', copies, permalink) }} {{ reaction('like', likes or [], 'u-like', anon_likes, 'like', 'likes', copies, permalink) }}
{{ reaction('repost', reposts or [], 'u-repost', anon_reposts, 'repost', 'reposts', copies, permalink) }} {{ reaction('repost', reposts or [], 'u-repost', anon_reposts, 'repost', 'reposts', copies, permalink) }}
{# Replies are listed in full below; here just the count and where to reply #} {# Replies are listed in full below; here just the count and where to reply #}
{{ reaction('reply', replies or [], '', [], 'reply', 'replies', copies, permalink, people=False) }} {{ reaction('reply', replies or [], '', [], 'reply', 'replies', copies, permalink, people=False) }}
{# Quotes: named ones are listed below; the card shows those without names (v2.14.2) #}
{{ reaction('quote', quotes or [], '', anon_quotes, 'quote', 'quotes', people=False) }}
{{ reaction('bookmark', bookmarks or [], 'u-bookmark', [], 'bookmark', 'bookmarks') }} {{ reaction('bookmark', bookmarks or [], 'u-bookmark', [], 'bookmark', 'bookmarks') }}
</div> </div>
{% endif %} {% endif %}
@@ -118,7 +122,7 @@
{% macro list_counts(counts, permalink) %} {% macro list_counts(counts, permalink) %}
{% if counts %} {% if counts %}
<a class="list-counts" href="{{ permalink }}#responses"> <a class="list-counts" href="{{ permalink }}#responses">
{%- for key, kind, one, many in [('likes', 'like', 'like', 'likes'), ('reposts', 'repost', 'repost', 'reposts'), ('replies', 'reply', 'reply', 'replies')] if counts[key] -%} {%- for key, kind, one, many in [('likes', 'like', 'like', 'likes'), ('reposts', 'repost', 'repost', 'reposts'), ('replies', 'reply', 'reply', 'replies'), ('quotes', 'quote', 'quote', 'quotes')] if counts.get(key) -%}
<span class="list-count list-count-{{ kind }}" title="{{ counts[key] }} {{ one if counts[key] == 1 else many }}">{{ ICONS[kind]|safe }}{{ counts[key] }}<span class="visually-hidden"> {{ one if counts[key] == 1 else many }}</span></span> <span class="list-count list-count-{{ kind }}" title="{{ counts[key] }} {{ one if counts[key] == 1 else many }}">{{ ICONS[kind]|safe }}{{ counts[key] }}<span class="visually-hidden"> {{ one if counts[key] == 1 else many }}</span></span>
{%- endfor -%} {%- endfor -%}
</a> </a>
+18
View File
@@ -639,3 +639,21 @@ def test_home_page_shows_counts(app, client):
assert 'title="3 likes"' in page and 'title="2 reposts"' in page and 'title="1 reply"' in page assert 'title="3 likes"' in page and 'title="2 reposts"' in page and 'title="1 reply"' in page
assert f"/note/{quiet.slug}#responses" not in page assert f"/note/{quiet.slug}#responses" not in page
assert 'id="responses"' in app.test_client().get(f"/note/{note.slug}").get_data(as_text=True) assert 'id="responses"' in app.test_client().get(f"/note/{note.slug}").get_data(as_text=True)
def test_quote_counts_include_anonymous_ones(app, client):
"""v2.14.2: quotes have a count, including those without names (Threads, opted out)"""
note, sid = crossposted(app)
client.harvest = Harvest([Response(kind="quote", source_url="https://bsky.app/profile/q/post/1",
remote_id="at://q/1", author_name="Quoter",
content_html="<p>Look</p>")])
run(app)
with app.app_context():
get_db(app).execute("UPDATE syndications SET quotes_count = 2 WHERE id = ?", (sid,))
get_db(app).commit()
page = app.test_client().get(f"/note/{note.slug}").get_data(as_text=True)
quote = page.split('response-count-quote')[1].split('</span>\n</span>')[0]
assert '<span class="response-count-n">3</span>' in quote and "2 on GoToSocial" in quote
assert "Quoter" in page, "the named quote is listed under Responses"
home = app.test_client().get("/").get_data(as_text=True)
assert 'title="3 quotes"' in home