fix: count opted-out likes and reposts without naming them (v2.13.3)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
76b81d6ad9
commit
113f28aff1
9 files changed
+85
-9
No files matched your search
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.13.3] - 2026-11-10
|
||||
|
||||
### Changed
|
||||
|
||||
- Likes and reposts by people who opted out of backfeed (`#nobridge` or `#nobot` in their profile, or Bluesky's "don't show me to logged-out users" label) are counted in a note's totals, without their name or avatar ("+1 on Bluesky"). Before, they were left out entirely, so totals were lower than on the silo
|
||||
|
||||
## [2.13.2] - 2026-11-10
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -235,6 +235,15 @@ While at it, the Threads client moves from `graph.threads.net` to
|
||||
the same action on each crosspost. No web-action polyfill is loaded;
|
||||
handlers such as browser extensions can use the markup.
|
||||
|
||||
## Amendments (v2.13.3, 2026-11-10)
|
||||
|
||||
- **Opted-out people are counted.** Their likes, reposts and quotes are
|
||||
still not stored or named (Decision 5), but each check records how many
|
||||
there were on the copy's `syndications` row (`likes_count`,
|
||||
`reposts_count`, `quotes_count`, the columns Threads' counts use), and
|
||||
the counts line adds them to the totals as "N on <silo>". Totals then
|
||||
match the silo.
|
||||
|
||||
## Consequences
|
||||
|
||||
- Responses on all three silos show on the note within 15 minutes for new
|
||||
|
||||
@@ -21,7 +21,7 @@ is in `../architecture/`; decisions are in `../decisions/` (ADRs).
|
||||
|
||||
## Contents
|
||||
|
||||
[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) · [hotfix](#hotfix)
|
||||
[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) · [hotfix](#hotfix)
|
||||
|
||||
## v1.0.0
|
||||
|
||||
@@ -434,6 +434,10 @@ OIDC admin login and built-in IndieAuth server.
|
||||
|
||||
- [2026-11-10-reaction-counts.md](v2.13.2/2026-11-10-reaction-counts.md) - Likes/reposts as a counts line with hover lists; web actions
|
||||
|
||||
## v2.13.3
|
||||
|
||||
- [2026-11-10-count-opted-out.md](v2.13.3/2026-11-10-count-opted-out.md) - Opted-out people's likes and reposts counted without names
|
||||
|
||||
## hotfix
|
||||
|
||||
Not a release folder.
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# v2.13.3: Count opted-out people without naming them
|
||||
|
||||
## Why
|
||||
|
||||
A note's Bluesky copy had 1 like on Bluesky and 0 on the note. The liker's
|
||||
account has the `!no-unauthenticated` label, so backfeed skipped them
|
||||
(ADR-073 Decision 5). Every other Bluesky copy's like and repost counts
|
||||
matched what StarPunk had stored.
|
||||
|
||||
## Change
|
||||
|
||||
`backfeed.hidden_counts(harvest)`: the silo's own counts when it gives no
|
||||
names (Threads), else the number of opted-out likes, reposts and quotes in
|
||||
the harvest. `check()` stores it on the copy's `syndications` row, and the
|
||||
counts line (v2.13.2) already adds those columns to the totals as
|
||||
"N on <silo>". Opted-out people are still not stored.
|
||||
|
||||
## Verification
|
||||
|
||||
`tests/test_backfeed.py::test_people_who_opt_out_are_counted_not_named`:
|
||||
label, `#nobot` and `#nobridge` opt-outs counted (2 likes, 1 repost), not
|
||||
stored, not named on the page; totals include them.
|
||||
@@ -4,7 +4,7 @@
|
||||
**Last Updated**: 2026-11-03 (v2.10.1)
|
||||
|
||||
StarPunk uses [Semantic Versioning 2.0.0](https://semver.org/):
|
||||
`MAJOR.MINOR.PATCH`, currently **2.13.2**. Every release is a git tag
|
||||
`MAJOR.MINOR.PATCH`, currently **2.13.3**. Every release is a git tag
|
||||
`vX.Y.Z` and a `CHANGELOG.md` entry. Where the number is stored and how to
|
||||
write the changelog entry is in
|
||||
[version-implementation-guide.md](version-implementation-guide.md); the
|
||||
|
||||
@@ -465,5 +465,5 @@ def create_app(config=None):
|
||||
|
||||
# Package version (Semantic Versioning 2.0.0)
|
||||
# See docs/standards/versioning-strategy.md for details
|
||||
__version__ = "2.13.2"
|
||||
__version_info__ = (2, 13, 2)
|
||||
__version__ = "2.13.3"
|
||||
__version_info__ = (2, 13, 3)
|
||||
+19
-3
@@ -64,7 +64,9 @@ class Harvest:
|
||||
"""What one check found. complete=False: some list was cut short."""
|
||||
responses: List[Response]
|
||||
complete: bool = True
|
||||
counts: Optional[Dict[str, int]] = None # Threads likes/reposts/quotes
|
||||
# Likes/reposts/quotes shown only as numbers: all of them on Threads
|
||||
# (its API doesn't say who); elsewhere, those by people who opted out
|
||||
counts: Optional[Dict[str, int]] = None
|
||||
|
||||
|
||||
# --- Text -----------------------------------------------------------------
|
||||
@@ -243,11 +245,25 @@ def _display_state(db, note_id: int) -> list:
|
||||
)]
|
||||
|
||||
|
||||
def hidden_counts(harvest: Harvest) -> Dict[str, int]:
|
||||
"""
|
||||
Likes, reposts and quotes to show only as numbers: the silo's own counts
|
||||
when it gives no names (Threads), else those by people who opted out
|
||||
(v2.13.3: they're counted, not named)
|
||||
"""
|
||||
if harvest.counts is not None:
|
||||
return harvest.counts
|
||||
hidden = [r.kind for r in harvest.responses if _opted_out(r)]
|
||||
return {k: hidden.count(kind) for k, kind in
|
||||
(("likes", "like"), ("reposts", "repost"), ("quotes", "quote"))}
|
||||
|
||||
|
||||
def store(db, note_id: int, target_url: str, origin: str, harvest: Harvest) -> None:
|
||||
"""
|
||||
Upsert a check's responses for one note and silo. With a complete
|
||||
harvest, that silo's responses for the note that weren't found are
|
||||
marked invalid. Responses from people who opted out are removed.
|
||||
marked invalid. Responses from people who opted out are removed (they
|
||||
are counted instead, see `hidden_counts`).
|
||||
"""
|
||||
from starpunk.webmention_processor import _snippet
|
||||
|
||||
@@ -358,7 +374,7 @@ def check(row, target) -> None:
|
||||
site = current_app.config["SITE_URL"].rstrip("/")
|
||||
harvest = target.client.responses(row["remote_id"], row["remote_url"] or "")
|
||||
store(db, row["note_id"], f"{site}/note/{row['note_slug']}", row["target"], harvest)
|
||||
_store_counts(db, row["id"], harvest.counts)
|
||||
_store_counts(db, row["id"], hidden_counts(harvest))
|
||||
|
||||
|
||||
def process_due(limit: int = 3) -> int:
|
||||
|
||||
@@ -56,8 +56,9 @@
|
||||
like other sites (v2.13.2). Hovering or focusing a count lists who, and
|
||||
offers the same action on the note's crossposts. Each action is an
|
||||
<indie-action> (https://indieweb.org/webactions) with those silo links as
|
||||
its fallback, so web action handlers can take over. Counts a silo gives
|
||||
without names (Threads) are added to the total. The people stay in the
|
||||
its fallback, so web action handlers can take over. Counts without names
|
||||
(all of Threads; elsewhere people who opted out, v2.13.3) are added to the
|
||||
total. The people stay in the
|
||||
markup as u-like / u-repost / u-bookmark h-cites. #}
|
||||
{% set ICONS = {
|
||||
'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>',
|
||||
|
||||
@@ -604,3 +604,21 @@ def test_own_gotosocial_redirect_to_remote_avatar_is_followed(app, web, monkeypa
|
||||
monkeypatch.setattr("starpunk.webmention_ssrf.TRANSPORT", httpx.MockTransport(fake))
|
||||
with app.app_context():
|
||||
assert avatars.fetch(app.config["DATA_PATH"], f"{GTS}/fileserver/x/avatar.jpeg", SITE)
|
||||
|
||||
|
||||
def test_people_who_opt_out_are_counted_not_named(app, client):
|
||||
"""v2.13.3: likes and reposts by people who opted out add to the totals anonymously"""
|
||||
note, sid = crossposted(app)
|
||||
shy = like(5, opted_out=True)
|
||||
client.harvest = Harvest([like(1), shy, like(6, bio="#nobot"),
|
||||
Response(kind="repost", source_url=f"{COPY}#reposted-by-7", remote_id="7",
|
||||
author_name="Quiet", author_bio="#nobridge")])
|
||||
run(app)
|
||||
with app.app_context():
|
||||
s = get_db(app).execute("SELECT likes_count, reposts_count FROM syndications WHERE id = ?",
|
||||
(sid,)).fetchone()
|
||||
assert (s["likes_count"], s["reposts_count"]) == (2, 1)
|
||||
assert [r["source_url"] for r in rows(app, note.id)] == [like(1).source_url]
|
||||
page = app.test_client().get(f"/note/{note.slug}").get_data(as_text=True)
|
||||
assert '<span class="reaction-count">3</span>' in page and "+2 on GoToSocial" in page
|
||||
assert "Liker 5" not in page and "Quiet" not in page
|
||||
Reference in new issue
Block a user