feat: likes and reposts as a counts line with hover lists, web actions (v2.13.2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-10 13:11:29 -07:00
1 parent b247de011d
commit 44f77a3adf
11 files changed
+178 -104

No files matched your search

+21 -1
View File
@@ -334,7 +334,11 @@ def test_note_page_shows_backfed_responses_quotes_and_counts(app, client, web):
page = app.test_client().get(f"/note/{note.slug}").get_data(as_text=True)
assert "via GoToSocial" in page
assert "1 Quote" in page and "Look at this" in page
assert 'class="silo-counts">On GoToSocial: 12 likes · 1 repost<' in page
# Likes and reposts are a counts line (v2.13.2): named likes plus the silo's anonymous count
assert '<span class="reaction-count">13</span>' in page and "+12 on GoToSocial" in page
assert '<span class="reaction-count">1</span>' in page
assert f'<indie-action class="reaction-elsewhere" do="like" with="{SITE}/note/{note.slug}">' in page
assert f'Like on <a href="{COPY}"' in page
assert 'src="/avatars/' in page and 'src="https://cdn.example/a.png"' not in page
@@ -584,3 +588,19 @@ def test_avatars_from_own_gotosocial_and_bluesky_pds(app, web, monkeypatch):
monkeypatch.setattr("starpunk.webmention_ssrf.socket.getaddrinfo",
lambda host, *a, **k: [(2, 1, 6, "", ("10.0.0.5", 0))])
assert not avatars.fetch(data, "https://internal.example/a.png", SITE)
def test_own_gotosocial_redirect_to_remote_avatar_is_followed(app, web, monkeypatch):
"""v2.13.2: GoToSocial redirects uncached remote media to the original server"""
class Redirecting(FakeWeb):
def __call__(self, request):
url = f"{request.url.scheme}://{request.headers['host']}{request.url.raw_path.decode()}"
if url == f"{GTS}/fileserver/x/avatar.jpeg":
return httpx.Response(302, headers={"location": "https://remote.example/avatar.jpeg"})
return super().__call__(request)
fake = Redirecting()
fake.files["https://remote.example/avatar.jpeg"] = png()
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)