Skip to content

Ads: they come with the welcome pages' lists, not every page - #429

Merged
TripleU613 merged 3 commits into
mainfrom
ads-with-welcome-lists
Nov 23, 2026
Merged

TripleU613 merged 3 commits into
mainfrom
ads-with-welcome-lists

Conversation

@TripleU613

Copy link
Copy Markdown
Owner

Summary

The ads (site.jt_lines) were in the site data that every page preloads: 26 KB on prod, on every page, topic pages included, though they only show in the welcome area (Home, Latest, Categories, unscoped). They now come inside those pages' own lists:

  • the unscoped Latest topic list: the homepage, /latest, and the Categories page's topics (categories_and_latest);
  • the unscoped Top topic list, for categories_and_top;
  • the top-level category list, for the categories-only style (prod's mobile).

There's still no request of their own for a blocker or the remover extension to drop; dropping them would mean dropping the topic list. In the browser, every path that turns such a response into a list passes through core's topic-list-topics-from or category-list-attributes value transformer, and that happens before the page renders. So the welcome area has the ads as it draws, with no layout shift. Arriving on a topic page and then going home brings them with Latest's list. Pages served before the deploy still read them from their site data.

Affected module(s)

  • Shared (plugin.rb, settings, locales, docs, lint/CI)

Module affected: Ads.

Test plan

  • spec/requests/ads_spec.rb: the ads come in /latest, /categories, /categories_and_latest and /top, and are absent from /site.json, a category's list, subcategories and a topic page; all existing audience, vote and preview specs pass.
  • spec/system/ads_spec.rb, new:
    • arriving on a topic page and going home shows the ad;
    • the Categories page shows it;
    • the fixed-size slot spec still passes.
  • spec/system/ads_remover_spec.rb (the remover extension): passes.
  • JTech theme part 2 (the hero hosting the ad): passes. The one failure in that file, "Me too on the post menu's line", fails on main too in the same container.
  • Totals: 82 examples, 1 failure, and that one is already on main.
  • eslint, prettier, ember-tsc, rubocop, stree: clean.

Checklist

  • pnpm lint is clean
  • bundle exec rubocop is clean
  • New / changed settings have entries in config/locales/server.en.yml or client.en.yml (none)
  • New / changed behavior has a spec (a bug fix has one that fails without it)
  • Follows the repository rules: no access past core, visibility checked, nothing core already does
  • No Ruby file references a non-existent setting name

🤖 Generated with Claude Code

https://claude.ai/code/session_01BUGDaR7qv2d8CuVp7UGSTs

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T01:42:26.792765Z e3e1aee New commits
🔒 Security Review ✅ Completed 2026-11-23T01:43:39.174852Z e3e1aee New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 58a09809c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +132 to +133
%w[latest top].include?(topic_list.filter.to_s) && topic_list.category.blank? &&
topic_list.tags.blank?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include ads for every configured homepage list

When default_homepage is a valid topic-list route such as hot, new, or unread, onWelcomeRoute() treats it as a welcome page, but this predicate only attaches jt_lines to latest and top. On a fresh session the homepage response therefore leaves listed empty and the welcome ad never renders; include every supported homepage filter and cover a non-latest homepage in the request/system specs.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

Comment thread sub_plugins/ads.rb
Comment on lines +25 to +26
include_condition: -> { DiscourseJtechAds.enabled? && DiscourseJtechAds.welcome_list?(object) },
) { DiscourseJtechAds.payload(scope) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid serializing the payload twice on Categories

For /categories_and_latest.json and /categories_and_top.json, the response contains both an unscoped topic_list and a top-level category_list. Both serializer conditions added here are therefore true, so the full ad payload is emitted under both lists (and a signed-in user's vote lookup is performed twice). Ensure that combined Categories responses carry jt_lines on only one of their child lists.

Useful? React with 👍 / 👎.

TripleU613 and others added 3 commits November 22, 2026 20:40
The ads were in the site data every page preloads: 26 KB on prod, on
topic pages too, which never show them. They now come inside the lists
the welcome area's pages are built from: the unscoped Latest (and Top)
topic list, which is also the homepage's and the Categories page's
topics, and the top-level category list. Still no request of their own
for a blocker to drop; a blocker that dropped them would drop the list.

In the browser every path that turns such a response into a list goes
through core's topic-list-topics-from or category-list-attributes value
transformer, before the page renders, so the welcome area has them as it
draws: no shift while they arrive. Arriving on a topic page and going
home fetches them with Latest's list. A page served before this still
reads them from its site data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BUGDaR7qv2d8CuVp7UGSTs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BUGDaR7qv2d8CuVp7UGSTs
the-curious-2025/jtech-ad-remover was taken off GitHub (404), so the
clone asked for a login and failed every run. With nothing to check
against the run now says so in its summary and passes; when the
repository is public again the check runs as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BUGDaR7qv2d8CuVp7UGSTs
@TripleU613
TripleU613 force-pushed the ads-with-welcome-lists branch from 8c58991 to e3e1aee Compare November 23, 2026 01:40
@TripleU613
TripleU613 merged commit 4947bfe into main Nov 23, 2026
@TripleU613
TripleU613 deleted the ads-with-welcome-lists branch November 23, 2026 01:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c589913d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +73 to +76
if ! git clone --depth 1 https://github.com/the-curious-2025/jtech-ad-remover.git ad-remover; then
echo "found=false" >> $GITHUB_OUTPUT
echo "The ad remover's repository isn't public any more; nothing to check." >> $GITHUB_STEP_SUMMARY
exit 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fail on clone errors unrelated to repository absence

In the ad-remover-check.yml workflow, this branch treats every nonzero git clone result as proof that the repository is no longer public. DNS, TLS, rate-limit, disk, or runner-network failures therefore set found=false, skip every verification step, and leave the scheduled job green, potentially disabling the monitor indefinitely without an alert. Only the expected repository-unavailable case should be suppressed; unexpected clone failures should still fail the job.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant