discourse/plugins/discourse-patreon
Rafael dos Santos Silva b4c5526c51
FIX: Restore "All Patrons" pseudo-tier in admin UI (#39349)
## Summary

The Patreon plugin maintains a synthetic `rewards[\"0\"]` tier ("All
Patrons") that catches every patron, including paying patrons whose
pledge doesn't map to any predefined tier. It's supposed to appear as
`\$0 - All Patrons` in the admin dropdown where group filters are
configured.

In affected campaigns, this option silently disappeared and was replaced
by `\$0 - Free` (Patreon's real default free tier, with its own numeric
id). Admins lost the ability to filter on "any patron".

### Root cause

`rewards[\"0\"] ||= {}` in `lib/campaign.rb` relied on Patreon's payload
having already populated `rewards[\"0\"][\"id\"] = \"0\"` via the
adapter's `parse_campaigns`. For campaigns where Patreon no longer
returns a reward keyed on `\"0\"` (e.g. when the campaign has a real
"Free" tier), the pseudo-tier ended up stored with only `title` and
`amount_cents` — no `id`.

The admin dropdown filters rewards client-side with `r.id >= 0` (in
`assets/javascripts/discourse/controllers/admin-plugins/patreon.js`).
Since `undefined >= 0` evaluates to `false`, "All Patrons" was dropped
from the options. Existing filter rules keyed on `\"0\"` continued to
work on the backend, but admins could no longer create or edit them.

### Fix

Assign `rewards[\"0\"][\"id\"] = \"0\"` explicitly so the pseudo-tier is
always selectable. Confirmed against a live v1 site:
`reward-users[\"0\"]` still tracked all 946 patrons, the backend state
was healthy, only the UI was broken. Applies equally to v1 and v2 since
the assignment runs adapter-agnostic.

Existing filter rules keyed on `\"0\"` keep working and start matching
again on the next sync — no data migration needed.

## Test plan

- [x] `bin/rspec plugins/discourse-patreon/spec/lib/campaign_spec.rb`
passes under both v1 and v2 shared examples, asserting `rewards[\"0\"]`
includes `id: \"0\"`
- [x] `bin/lint` clean
- [ ] On the affected site, run \`Patreon::Campaign.update!\` (or click
*Update Data*) and verify \`\$0 - All Patrons\` reappears in the admin
dropdown and can be assigned to a group
2026-04-17 14:15:37 -03:00
..
app DEV: Upgrade Patreon plugin to API v2 with v1 backward compatibility (#38871) 2026-03-30 14:43:34 -03:00
assets DEV: Migrate to @ember/reactive/collections (#38221) 2026-03-23 17:44:41 -03:00
config I18N: Update translations (#39029) 2026-04-01 11:13:02 +02:00
db/migrate
lib FIX: Restore "All Patrons" pseudo-tier in admin UI (#39349) 2026-04-17 14:15:37 -03:00
public/images
spec FIX: Restore "All Patrons" pseudo-tier in admin UI (#39349) 2026-04-17 14:15:37 -03:00
svg-icons
package.json DEV: Add a script for generating external types in discourse-types (#37095) 2026-03-09 20:37:43 +01:00
plugin.rb DEV: Upgrade Patreon plugin to API v2 with v1 backward compatibility (#38871) 2026-03-30 14:43:34 -03:00
README.md
tsconfig.json DEV: Add a script for generating external types in discourse-types (#37095) 2026-03-09 20:37:43 +01:00

Discourse Patreon

Enable syncronization between Discourse Groups and Patreon rewards, and enable Patreon Social Login,

Installation

Proceed with a normal installation of a plugin.

After Installation

You need to fill the following fields on Settings -> Plugins:

  • Client ID
  • Client Secret
  • Creator's Access Token
  • Creator's Refesh Token

To get those values you must have a Creator account first.

Then go to Clients & API Keys and fill the necessary info.

The Redirect URIs must be http://<DISCOURSE BASE URL>/auth/patreon/callback, like https://meta.discourse.org/auth/patreon/callback for example.

Then you use the generated tokens to configure the plugin.

Webhooks

You should create Patreon Webhooks so every new pledge get's synced to Discourse ASAP.

To get it working, create a new Webhook for each trigger type and point then to https://<DISCOURSE BASE URL>/patreon/webhook, like https://meta.discourse.org/patreon/webhook for example.

Group Sync

If you want to give your patrons a special treatment on your board, you can create rules between Discourse Groups and Patreon reward tiers.

This can pave the way to grant category access, titles and custom css to please your patrons!

Social Login

This plugin will also enable a Social Login with Patreon, making it easier for your patron to sign up on Discourse.

About

This is a work in progress! Feel free to use and ask questions here, or on Meta.

TODO

  • Button to invite patrons who aren't on Discourse yet.