fix: a Discord source takes only messages with an image attached, from the posters it names, and knows its channel's name (#4481)
CI and images / lint (push) Successful in 4s
CI and images / extension-version (push) Successful in 3s
CI and images / frontend-build (push) Successful in 21s
CI and images / extension-test (push) Successful in 20s
CI and images / backend-lint-and-test (push) Successful in 34s
CI and images / integration (push) Successful in 2m24s
CI and images / sign-extension (push) Successful in 3s
CI and images / build-agent (push) Successful in 7s
CI and images / build-web (push) Successful in 1m42s
CI and images / smoke-web (push) Successful in 59s
CI and images / promote (push) Successful in 2s
CI and images / lint (push) Successful in 4s
CI and images / extension-version (push) Successful in 3s
CI and images / frontend-build (push) Successful in 21s
CI and images / extension-test (push) Successful in 20s
CI and images / backend-lint-and-test (push) Successful in 34s
CI and images / integration (push) Successful in 2m24s
CI and images / sign-extension (push) Successful in 3s
CI and images / build-agent (push) Successful in 7s
CI and images / build-web (push) Successful in 1m42s
CI and images / smoke-web (push) Successful in 59s
CI and images / promote (push) Successful in 2s
- A message with no image or video attachment is chat: extract_media returns nothing for it, so nothing downloads and no post record is written. A message that passes keeps every file, numbered as gallery-dl numbers them. - `discord_authors` in a source's config limits the walk to those posters (id, username or display name); the edit dialog has a field for it and no longer drops config keys it has no field for. - source.display_name (migration 0115), refreshed by every Discord walk, shows on Subscriptions in place of the two-id URL; a Discord post card names its channel from the record's `channel`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -283,6 +283,27 @@ async def test_scroll_item_shape_minimal(db):
|
||||
assert "description_full" not in item
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_a_discord_post_names_its_channel(db):
|
||||
"""#4481: the card says which channel a message came from. Read from the
|
||||
record's `channel`; never on another platform, even with the same key."""
|
||||
artist = await _seed_artist(db, "todding-ch")
|
||||
dsrc = await _seed_source(db, artist.id, "discord", "https://discord.com/channels/1/2")
|
||||
psrc = await _seed_source(db, artist.id, "patreon", "https://p/todding-ch")
|
||||
now = datetime.now(UTC)
|
||||
d = await _seed_post(db, dsrc.id, external_id="D1", post_date=now)
|
||||
d.raw_metadata = {"category": "discord", "channel": "banana-land"}
|
||||
blank = await _seed_post(db, dsrc.id, external_id="D2", post_date=now)
|
||||
blank.raw_metadata = {"category": "discord", "channel": " "}
|
||||
p = await _seed_post(db, psrc.id, external_id="P1", post_date=now)
|
||||
p.raw_metadata = {"channel": "not-discord"}
|
||||
await db.commit()
|
||||
|
||||
page = await PostFeedService(db).scroll(cursor=None, limit=10, artist_id=artist.id)
|
||||
by_id = {it["external_post_id"]: it["channel"] for it in page["items"]}
|
||||
assert by_id == {"D1": "banana-land", "D2": None, "P1": None}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_scroll_surfaces_translation_fields(db):
|
||||
# #143: a translated post exposes the translated title/description + source
|
||||
|
||||
Reference in New Issue
Block a user