Skip to content

A platform for community discussion. Free, open, simple.

DEV: Move discourse-patreon to core (#33570)

Jarek Radosz683ee9c35300
diff --git a/.github/labeler.yml b/.github/labeler.yml
index fb33a0ae6dc..70a7b21b409 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -58,6 +58,10 @@ discourse-zendesk-plugin:
- changed-files:
- any-glob-to-any-file: plugins/discourse-zendesk-plugin/**/*
+discourse-patreon:
+ - changed-files:
+ - any-glob-to-any-file: plugins/discourse-patreon/**/*
+
footnote:
- changed-files:
- any-glob-to-any-file: plugins/footnote/**/*
diff --git a/.gitignore b/.gitignore
index 88de60ad250..900242ccc43 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,6 +57,7 @@
!/plugins/discourse-oauth2-basic
!/plugins/discourse-openid-connect
!/plugins/discourse-zendesk-plugin
+!/plugins/discourse-patreon
/plugins/*/auto_generated
/spec/fixtures/plugins/my_plugin/auto_generated
diff --git a/plugins/discourse-patreon/README.md b/plugins/discourse-patreon/README.md
new file mode 100644
index 00000000000..91506621aa8
--- /dev/null
+++ b/plugins/discourse-patreon/README.md
@@ -0,0 +1,50 @@
+# Discourse Patreon
+
+Enable syncronization between Discourse Groups and Patreon rewards, and enable Patreon Social Login,
+
+<img src="public/images/patreon-wordmark-navy.png?raw=true" width="292" height="104">
+
+## Installation
+
+Proceed with a normal [installation of a plugin](https://meta.discourse.org/t/install-a-plugin/19157?u=falco).
+
+## 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](https://www.patreon.com/become-a-patreon-creator).
+
+Then go to [Clients & API Keys](https://www.patreon.com/platform/documentation/clients) 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](https://www.patreon.com/platform/documentation/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](https://meta.discourse.org/t/discourse-patreon-login/44366?u=falco).
+
+## TODO
+
+- Button to invite patrons who aren't on Discourse yet.
diff --git a/plugins/discourse-patreon/app/controllers/patreon_admin_controller.rb b/plugins/discourse-patreon/app/controllers/patreon_admin_controller.rb
new file mode 100644
index 00000000000..732cd67e91b
--- /dev/null
+++ b/plugins/discourse-patreon/app/controllers/patreon_admin_controller.rb
@@ -0,0 +1,102 @@
+# frozen_string_literal: true
+
+require_dependency "application_controller"
+
+class ::Patreon::PatreonAdminController < Admin::AdminController
+ PLUGIN_NAME = "discourse-patreon".freeze
+
+ requires_plugin PLUGIN_NAME
+
+ before_action :patreon_enabled?
+ before_action :patreon_tokens_present?
+
+ def patreon_enabled?
+ raise Discourse::NotFound unless SiteSetting.patreon_enabled
+ end
+
+ def list
+ filters = PluginStore.get(PLUGIN_NAME, "filters") || {}
+ rewards = ::Patreon::Reward.all
+ last_sync = ::Patreon.get("last_sync") || {}
+
+ groups = ::Group.all.pluck(:id)
+
+ valid_filters = filters.select { |k| groups.include?(k.to_i) }
+
+ render json: { filters: valid_filters, rewards: rewards, last_sync_at: last_sync["at"] }
+ end
+
+ def rewards
+ rewards = ::Patreon::Reward.all
+
+ render json: rewards
+ end
+
+ def is_number?(string)
+ begin
+ true if Float(string)
+ rescue StandardError
+ false
+ end
+ end
+
+ def edit
+ if params[:rewards_ids].nil? || !is_number?(params[:group_id])
+ return render json: { message: "Error" }, status: 500
+ end
+
+ filters = PluginStore.get(PLUGIN_NAME, "filters") || {}
+
+ filters[params[:group_id]] = params[:rewards_ids]
+
+ PluginStore.set(PLUGIN_NAME, "filters", filters)
+
+ render json: success_json
+ end
+
+ def delete
+ return render json: { message: "Error" }, status: 500 unless is_number?(params[:group_id])
+
+ filters = PluginStore.get(PLUGIN_NAME, "filters")
+
+ filters.delete(params[:group_id])
+
+ PluginStore.set(PLUGIN_NAME, "filters", filters)
+
+ render json: success_json
+ end
+
+ def sync_groups
+ begin
+ Patreon::Patron.sync_groups
+ render json: success_json
+ rescue => e
+ render json: { message: e.message }, status: 500
+ end
+ end
+
+ def update_data
+ Jobs.enqueue(:patreon_sync_patrons_to_groups)
+ render json: success_json
+ end
+
+ def email
+ user = fetch_user_from_params(include_inactive: true)
+
+ unless user == current_user
+ guardian.ensure_can_check_emails!(user)
+ StaffActionLogger.new(current_user).log_check_email(user, context: params[:context])
+ end
+
+ render json: { email: ::Patreon::Patron.attr("email", user) }
+ end
+
+ def patreon_tokens_present?
+ if SiteSetting.patreon_creator_access_token.blank?
+ raise Discourse::SiteSettingMissing.new("patreon_creator_access_token")
+ end
+ if SiteSetting.patreon_creator_refresh_token.blank?
+ raise Discourse::SiteSettingMissing.new("patreon_creator_refresh_token")
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/app/controllers/patreon_webhook_controller.rb b/plugins/discourse-patreon/app/controllers/patreon_webhook_controller.rb
new file mode 100644
index 00000000000..ba485933db5
--- /dev/null
+++ b/plugins/discourse-patreon/app/controllers/patreon_webhook_controller.rb
@@ -0,0 +1,79 @@
+# frozen_string_literal: true
+
+require "openssl"
+require "json"
+
+class ::Patreon::PatreonWebhookController < ApplicationController
+ requires_plugin ::Patreon::PLUGIN_NAME
+
+ skip_before_action :redirect_to_login_if_required,
+ :preload_json,
+ :check_xhr,
+ :verify_authenticity_token
+
+ TRIGGERS = %w[
+ pledges:create
+ pledges:update
+ pledges:delete
+ members:pledge:create
+ members:pledge:update
+ members:pledge:delete
+ ]
+
+ def index
+ if unknown_trigger?
+ message = event.blank? ? "Missing event header" : "Unknown event: #{event}"
+ Rails.logger.warn("Patreon Webhook failed: #{message}") if SiteSetting.patreon_verbose_log
+ render_json_error(message, status: 403)
+ return
+ end
+
+ if !valid_signature?
+ if SiteSetting.patreon_verbose_log
+ Rails.logger.warn("Patreon Webhook failed: Invalid signature")
+ end
+ render_json_error("Invalid signature", status: 403)
+ return
+ end
+
+ pledge_data = JSON.parse(request.body.read)
+ patreon_id = Patreon::Pledge.get_patreon_id(pledge_data)
+
+ if SiteSetting.patreon_verbose_log
+ Rails.logger.warn(
+ "Patreon verbose log for Webhook:\n Event = #{event}\n Id = #{patreon_id}\n Data = #{pledge_data.inspect}",
+ )
+ end
+
+ case event
+ when "pledges:create", "members:pledge:create"
+ Patreon::Pledge.create!(pledge_data)
+ when "pledges:update", "members:pledge:update"
+ Patreon::Pledge.update!(pledge_data)
+ when "pledges:delete", "members:pledge:delete"
+ Patreon::Pledge.delete!(pledge_data)
+ end
+
+ Jobs.enqueue(:sync_patron_groups, patreon_id: patreon_id)
+
+ render body: nil, status: 200
+ end
+
+ def event
+ request.headers["X-Patreon-Event"]
+ end
+
+ def unknown_trigger?
+ TRIGGERS.exclude?(event)
+ end
+
+ private
+
+ def valid_signature?
+ signature = request.headers["X-Patreon-Signature"]
+ digest = OpenSSL::Digest.new("MD5")
+
+ signature ==
+ OpenSSL::HMAC.hexdigest(digest, SiteSetting.patreon_webhook_secret, request.raw_post)
+ end
+end
diff --git a/plugins/discourse-patreon/app/jobs/regular/sync_patron_groups.rb b/plugins/discourse-patreon/app/jobs/regular/sync_patron_groups.rb
new file mode 100644
index 00000000000..ebbbfaafa0f
--- /dev/null
+++ b/plugins/discourse-patreon/app/jobs/regular/sync_patron_groups.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+module ::Jobs
+ class SyncPatronGroups < ::Jobs::Base
+ def execute(args)
+ ::Patreon::Patron.sync_groups_by(patreon_id: args[:patreon_id])
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/app/jobs/scheduled/patreon_sync_patrons_to_groups.rb b/plugins/discourse-patreon/app/jobs/scheduled/patreon_sync_patrons_to_groups.rb
new file mode 100644
index 00000000000..76bd7880889
--- /dev/null
+++ b/plugins/discourse-patreon/app/jobs/scheduled/patreon_sync_patrons_to_groups.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module ::Jobs
+ class PatreonSyncPatronsToGroups < ::Jobs::Scheduled
+ every 6.hours
+ sidekiq_options retry: false
+
+ def execute(args)
+ unless SiteSetting.patreon_enabled && SiteSetting.patreon_creator_access_token &&
+ SiteSetting.patreon_creator_refresh_token
+ return
+ end
+
+ ::Patreon::Patron.update!
+ ::Patreon.set("last_sync", at: Time.now)
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/app/jobs/scheduled/patreon_update_tokens.rb b/plugins/discourse-patreon/app/jobs/scheduled/patreon_update_tokens.rb
new file mode 100644
index 00000000000..1e1129265d7
--- /dev/null
+++ b/plugins/discourse-patreon/app/jobs/scheduled/patreon_update_tokens.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module ::Jobs
+ class PatreonUpdateTokens < ::Jobs::Scheduled
+ every 7.days
+
+ def execute(args)
+ if SiteSetting.patreon_enabled && SiteSetting.patreon_creator_access_token &&
+ SiteSetting.patreon_creator_refresh_token
+ ::Patreon::Tokens.update!
+ end
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/app/services/problem_check/access_token_invalid.rb b/plugins/discourse-patreon/app/services/problem_check/access_token_invalid.rb
new file mode 100644
index 00000000000..a62e7a2f31f
--- /dev/null
+++ b/plugins/discourse-patreon/app/services/problem_check/access_token_invalid.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class ProblemCheck::AccessTokenInvalid < ::ProblemCheck::InlineProblemCheck
+ self.priority = "high"
+
+ private
+
+ def translation_key
+ "dashboard.patreon.access_token_invalid"
+ end
+end
diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/connectors/admin-user-details/patreon.gjs b/plugins/discourse-patreon/assets/javascripts/discourse/connectors/admin-user-details/patreon.gjs
new file mode 100644
index 00000000000..6be6782ae4c
--- /dev/null
+++ b/plugins/discourse-patreon/assets/javascripts/discourse/connectors/admin-user-details/patreon.gjs
@@ -0,0 +1,106 @@
+import Component from "@ember/component";
+import { action } from "@ember/object";
+import { classNames, tagName } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
+import icon from "discourse/helpers/d-icon";
+import htmlSafe from "discourse/helpers/html-safe";
+import { ajax } from "discourse/lib/ajax";
+import { userPath } from "discourse/lib/url";
+import { i18n } from "discourse-i18n";
+
+@tagName("div")
+@classNames("admin-user-details-outlet", "patreon")
+export default class Patreon extends Component {
+ static shouldRender(args, context) {
+ return context.siteSettings.patreon_enabled && args.model.patreon_id;
+ }
+
+ init() {
+ super.init(...arguments);
+ this.set("patron_url", "https://patreon.com/members");
+ }
+
+ @action
+ checkPatreonEmail(user) {
+ ajax(userPath(`${user.username_lower}/patreon_email.json`), {
+ data: {
+ context: window.location.pathname,
+ },
+ }).then((result) => {
+ if (result) {
+ const email = result.email;
+ let url = "https://patreon.com/members";
+ if (email) {
+ url = `${url}?query=${email}`;
+ }
+ this.set("patreon_email", email);
+ this.set("patron_url", url);
+ }
+ });
+ }
+
+ <template>
+ <section class="details">
+ <h1>{{i18n "patreon.title"}}</h1>
+ <div class="display-row">
+ <div class="field">{{i18n "patreon.field.id"}}</div>
+ <div class="value">{{this.model.patreon_id}}</div>
+ </div>
+ {{#if this.model.patreon_email_exists}}
+ <div class="display-row">
+ <div class="field">{{i18n "patreon.field.email"}}</div>
+ <div class="value">
+ {{#if this.patreon_email}}
+ {{this.patreon_email}}
+ {{else}}
+ <DButton
+ {{! template-lint-disable no-action }}
+ @action={{action "checkPatreonEmail" this.model}}
+ @icon="far-envelope"
+ @label="admin.users.check_email.text"
+ @title="admin.users.check_email.title"
+ class="btn-default"
+ />
+ {{/if}}
+ </div>
+ </div>
+ {{/if}}
+ {{#if this.model.patreon_amount_cents}}
+ <div class="display-row">
+ <div class="field">{{i18n "patreon.field.amount_cents"}}</div>
+ <div class="value">{{this.model.patreon_amount_cents}}</div>
+ </div>
+ {{/if}}
+ {{#if this.model.patreon_rewards}}
+ <div class="display-row">
+ <div class="field">{{i18n "patreon.field.rewards"}}</div>
+ <div class="value">{{this.model.patreon_rewards}}</div>
+ </div>
+ {{/if}}
+ {{#if this.model.patreon_declined_since}}
+ <div class="display-row">
+ <div class="field">{{i18n "patreon.field.declined_since"}}</div>
+ <div class="value">{{htmlSafe
+ this.format-date
+ this.model.patreon_declined_since
+ }}</div>
+ </div>
+ {{/if}}
+ <div class="display-row">
+ <div class="field">{{i18n "patreon.field.more_details.label"}}</div>
+ <div class="value">
+ <a rel="noopener noreferrer" target="_blank" href={{this.patron_url}}>
+ {{icon "up-right-from-square"}}
+ </a>
+ </div>
+ <div class="controls">
+ {{#if this.model.patreon_email}}
+ {{i18n "patreon.field.more_details.help_text.email_available"}}
+ {{else}}
+ {{i18n "patreon.field.more_details.help_text.email_not_available"}}
+ {{/if}}
+ </div>
+ </div>
+ </section>
+ </template>
+}
diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/connectors/topic-above-footer-buttons/patreon.gjs b/plugins/discourse-patreon/assets/javascripts/discourse/connectors/topic-above-footer-buttons/patreon.gjs
new file mode 100644
index 00000000000..c7afc9cbb5b
--- /dev/null
+++ b/plugins/discourse-patreon/assets/javascripts/discourse/connectors/topic-above-footer-buttons/patreon.gjs
@@ -0,0 +1,65 @@
+import Component from "@ember/component";
+import { on } from "@ember/modifier";
+import { action } from "@ember/object";
+import { classNames, tagName } from "@ember-decorators/component";
+import $ from "jquery";
+import icon from "discourse/helpers/d-icon";
+import htmlSafe from "discourse/helpers/html-safe";
+import cookie from "discourse/lib/cookie";
+import { i18n } from "discourse-i18n";
+
+let numTopicsOpened = 0;
+const cookieName = "PatreonDonationPromptClosed";
+export function incrementTopicsOpened() {
+ numTopicsOpened++;
+}
+
+@tagName("div")
+@classNames("topic-above-footer-buttons-outlet", "patreon")
+export default class Patreon extends Component {
+ static shouldRender(_args, context) {
+ return context.currentUser;
+ }
+
+ init() {
+ super.init(...arguments);
+ this.didInsertElement = function () {
+ const showDonationPrompt =
+ this.siteSettings.patreon_enabled &&
+ this.siteSettings.patreon_donation_prompt_enabled &&
+ this.siteSettings.patreon_donation_prompt_campaign_url !== "" &&
+ this.currentUser.show_donation_prompt &&
+ cookie(cookieName) !== "t" &&
+ numTopicsOpened >
+ this.siteSettings.patreon_donation_prompt_show_after_topics;
+ this.set("showDonationPrompt", showDonationPrompt);
+ };
+ }
+
+ @action
+ close() {
+ // hide the donation prompt for 30 days
+ const expires = moment().add(30, "d").toDate();
+ cookie(cookieName, "t", {
+ expires,
+ });
+ $(this.element).fadeOut(700);
+ }
+
+ <template>
+ {{#if this.showDonationPrompt}}
+ <div class="patreon-donation-prompt">
+ <span {{on "click" this.close}} role="button" class="close">
+ {{icon "xmark"}}
+ </span>
+
+ {{htmlSafe
+ (i18n
+ "patreon.donation_prompt.body"
+ campaignUrl=this.siteSettings.patreon_donation_prompt_campaign_url
+ )
+ }}
+ </div>
+ {{/if}}
+ </template>
+}
diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/controllers/admin-plugins-patreon.js b/plugins/discourse-patreon/assets/javascripts/discourse/controllers/admin-plugins-patreon.js
new file mode 100644
index 00000000000..8b1df9e5eaf
--- /dev/null
+++ b/plugins/discourse-patreon/assets/javascripts/discourse/controllers/admin-plugins-patreon.js
@@ -0,0 +1,105 @@
+import Controller from "@ember/controller";
+import { action } from "@ember/object";
+import { service } from "@ember/service";
+import { ajax } from "discourse/lib/ajax";
+import { popupAjaxError } from "discourse/lib/ajax-error";
+import discourseComputed from "discourse/lib/decorators";
+import getURL from "discourse/lib/get-url";
+import { i18n } from "discourse-i18n";
+import FilterRule from "discourse/plugins/discourse-patreon/discourse/models/filter-rule";
+
+export default class AdminPluginsPatreonController extends Controller {
+ @service dialog;
+
+ editing = FilterRule.create({ group_id: null });
+
+ prettyPrintReward(reward) {
+ return `$${reward.amount_cents / 100} - ${reward.title}`;
+ }
+
+ @discourseComputed("rewards")
+ rewardsNames() {
+ return Object.values(this.rewards)
+ .filter((r) => r.id >= 0)
+ .map((r) => this.prettyPrintReward(r));
+ }
+
+ @action
+ save() {
+ const rule = this.get("editing");
+ const model = this.get("model");
+
+ rule.set(
+ "group",
+ this.groups.find((x) => x.id === parseInt(rule.get("group_id"), 10))
+ );
+ rule.set(
+ "rewards_ids",
+ Object.values(this.rewards)
+ .filter((v) =>
+ rule.get("reward_list").includes(this.prettyPrintReward(v))
+ )
+ .map((r) => r.id)
+ );
+
+ ajax("/patreon/list.json", {
+ method: "POST",
+ data: rule.getProperties("group_id", "rewards_ids"),
+ })
+ .then(() => {
+ let obj = model.find((x) => x.get("group_id") === rule.get("group_id"));
+ const rewards = rule.get("reward_list").filter(Boolean);
+ if (obj) {
+ obj.set("reward_list", rewards);
+ obj.set("rewards", rewards);
+ obj.set("rewards_ids", rule.rewards_ids);
+ } else {
+ model.pushObject(
+ FilterRule.create({
+ group: rule.get("group.name"),
+ rewards,
+ })
+ );
+ }
+ this.set("editing", FilterRule.create({ group_id: null }));
+ })
+ .catch(popupAjaxError);
+ }
+
+ @action
+ delete(rule) {
+ const model = this.get("model");
+
+ ajax("/patreon/list.json", {
+ method: "DELETE",
+ data: rule.getProperties("group_id"),
+ })
+ .then(() => {
+ let obj = model.find((x) => x.get("group_id") === rule.get("group_id"));
+ model.removeObject(obj);
+ })
+ .catch(popupAjaxError);
+ }
+
+ @action
+ updateData() {
+ this.set("updatingData", true);
+
+ ajax("/patreon/update_data.json", { method: "POST" })
+ .catch(popupAjaxError)
+ .finally(() => this.set("updatingData", false));
+
+ this.messageBus.subscribe("/patreon/background_sync", () => {
+ this.messageBus.unsubscribe("/patreon/background_sync");
+
+ this.set("updatingData", false);
+
+ const refreshUrl = getURL("/admin/plugins/patreon");
+ this.dialog.alert({
+ message: i18n("patreon.refresh_page"),
+ didConfirm: () => (window.location.pathname = refreshUrl),
+ didCancel: () => (window.location.pathname = refreshUrl),
+ });
+ });
+ }
+}
diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/initializers/patreon.js b/plugins/discourse-patreon/assets/javascripts/discourse/initializers/patreon.js
new file mode 100644
index 00000000000..3d6dd27e038
--- /dev/null
+++ b/plugins/discourse-patreon/assets/javascripts/discourse/initializers/patreon.js
@@ -0,0 +1,27 @@
+import { withPluginApi } from "discourse/lib/plugin-api";
+import { incrementTopicsOpened } from "../connectors/topic-above-footer-buttons/patreon";
+
+function initWithApi(api) {
+ const currentUser = api.getCurrentUser();
+
+ api.onAppEvent("page:topic-loaded", (topic) => {
+ if (!topic) {
+ return;
+ }
+
+ const isPrivateMessage = topic.isPrivateMessage;
+
+ if (!currentUser || isPrivateMessage) {
+ return;
+ }
+
+ incrementTopicsOpened();
+ });
+}
+
+export default {
+ name: "patreon",
+ initialize() {
+ withPluginApi("0.8", initWithApi);
+ },
+};
diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/models/filter-rule.js b/plugins/discourse-patreon/assets/javascripts/discourse/models/filter-rule.js
new file mode 100644
index 00000000000..58a564cbec8
--- /dev/null
+++ b/plugins/discourse-patreon/assets/javascripts/discourse/models/filter-rule.js
@@ -0,0 +1,6 @@
+import RestModel from "discourse/models/rest";
+
+export default class FilterRule extends RestModel {
+ group_id = -1;
+ reward_list = "";
+}
diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/patreon-route-map.js b/plugins/discourse-patreon/assets/javascripts/discourse/patreon-route-map.js
new file mode 100644
index 00000000000..57141c49bdb
--- /dev/null
+++ b/plugins/discourse-patreon/assets/javascripts/discourse/patreon-route-map.js
@@ -0,0 +1,7 @@
+export default {
+ resource: "admin.adminPlugins",
+ path: "/plugins",
+ map() {
+ this.route("patreon");
+ },
+};
diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/routes/admin-plugins-patreon.js b/plugins/discourse-patreon/assets/javascripts/discourse/routes/admin-plugins-patreon.js
new file mode 100644
index 00000000000..fb156ce324d
--- /dev/null
+++ b/plugins/discourse-patreon/assets/javascripts/discourse/routes/admin-plugins-patreon.js
@@ -0,0 +1,59 @@
+import { Promise } from "rsvp";
+import { ajax } from "discourse/lib/ajax";
+import { popupAjaxError } from "discourse/lib/ajax-error";
+import Group from "discourse/models/group";
+import DiscourseRoute from "discourse/routes/discourse";
+import FilterRule from "discourse/plugins/discourse-patreon/discourse/models/filter-rule";
+
+/* We use three main model to get this page working:
+ * Discourse Groups (excluding the automatic ones), Patreon rewards and
+ * and current filters (one filter is a tuple between 1 Discourse group and N Patreon rewards)
+ */
+export default class AdminPluginsPatreon extends DiscourseRoute {
+ model() {
+ return Promise.all([
+ ajax("/patreon/list.json"),
+ Group.findAll({ ignore_automatic: true }),
+ ])
+ .then(([result, groups]) => {
+ groups = groups.map((g) => {
+ return { id: g.id, name: g.name };
+ });
+
+ return {
+ filters: result.filters,
+ rewards: result.rewards,
+ last_sync_at: result.last_sync_at,
+ groups,
+ };
+ })
+ .catch(popupAjaxError);
+ }
+
+ setupController(controller, model) {
+ const rewards = model.rewards;
+ const groups = model.groups;
+ const filtersArray = Object.entries(model.filters).map(([k, v]) => {
+ const rewardsNames = v.map((r) =>
+ rewards[r]
+ ? ` $${rewards[r].amount_cents / 100} - ${rewards[r].title}`
+ : ""
+ );
+ const group = groups.find((g) => g.id === parseInt(k, 10));
+
+ return FilterRule.create({
+ group: group.name,
+ rewards: rewardsNames,
+ group_id: k,
+ reward_ids: v,
+ });
+ });
+
+ controller.setProperties({
+ model: filtersArray,
+ groups,
+ rewards,
+ last_sync_at: model.last_sync_at,
+ });
+ }
+}
diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/templates/admin/plugins-patreon.gjs b/plugins/discourse-patreon/assets/javascripts/discourse/templates/admin/plugins-patreon.gjs
new file mode 100644
index 00000000000..38b63a033d3
--- /dev/null
+++ b/plugins/discourse-patreon/assets/javascripts/discourse/templates/admin/plugins-patreon.gjs
@@ -0,0 +1,88 @@
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import formatDate from "discourse/helpers/format-date";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+import ListSetting from "select-kit/components/list-setting";
+
+export default RouteTemplate(
+ <template>
+ <section id="patreon">
+ <h1>{{i18n "patreon.header.rules"}}</h1>
+ <table>
+ <thead>
+ <tr>
+ <th>{{i18n "patreon.group"}}</th>
+ <th>{{i18n "patreon.rewards"}}</th>
+ <th></th>
+ </tr>
+ </thead>
+
+ <tbody>
+ {{#each @controller.model as |rule|}}
+ <tr class>
+ <td>{{rule.group}}</td>
+ <td>{{rule.rewards}}</td>
+ <td>
+ <div class="pull-right">
+ <DButton
+ @action={{@controller.delete}}
+ @actionParam={{rule}}
+ @icon="far-trash-can"
+ @title="patreon.delete"
+ class="delete btn-danger"
+ />
+ </div>
+ </td>
+ </tr>
+ {{/each}}
+ </tbody>
+
+ <tfoot>
+ <tr class="new-filter">
+ <td><ComboBox
+ @value={{@controller.editing.group_id}}
+ @content={{@controller.groups}}
+ @nameProperty="name"
+ @valueProperty="id"
+ @none="patreon.select_group"
+ /></td>
+ <td><ListSetting
+ @value={{@controller.editing.reward_list}}
+ @choices={{@controller.rewardsNames}}
+ class="rewards"
+ /></td>
+ <td>
+ <div class="pull-right">
+ <DButton
+ @action={{@controller.save}}
+ @icon="check"
+ @title="patreon.save"
+ class="save btn-primary"
+ />
+ </div>
+ </td>
+ </tr>
+ </tfoot>
+ </table>
+
+ <p>{{i18n "patreon.help_text"}}</p>
+
+ <DButton
+ @action={{@controller.updateData}}
+ @icon="refresh"
+ @disabled={{@controller.updatingData}}
+ @title="patreon.update_data"
+ @label="patreon.update_data"
+ />
+
+ {{#if @controller.last_sync_at}}
+ <span class="last_synced">
+ {{i18n "patreon.last_synced"}}:
+ {{htmlSafe (formatDate @controller.last_sync_at leaveAgo="true")}}
+ </span>
+ {{/if}}
+ </section>
+ </template>
+);
diff --git a/plugins/discourse-patreon/assets/stylesheets/patreon.scss b/plugins/discourse-patreon/assets/stylesheets/patreon.scss
new file mode 100644
index 00000000000..d9dac31ba65
--- /dev/null
+++ b/plugins/discourse-patreon/assets/stylesheets/patreon.scss
@@ -0,0 +1,38 @@
+.admin-detail #patreon {
+ .new-filter input.channel {
+ margin-bottom: 0;
+ }
+
+ .select2-container-multi .select2-choices {
+ border: 1px solid #e9e9e9;
+ }
+
+ h1 {
+ margin-bottom: 15px;
+ }
+
+ .error {
+ color: #f55959;
+ }
+
+ .last_synced {
+ margin-left: 5px;
+ }
+}
+
+.badge-card.patreon .badge-contents .badge-icon img {
+ max-width: 48px;
+}
+
+.patreon-donation-prompt {
+ clear: both;
+ padding: 15px;
+ border-radius: 3px;
+ background-color: var(--tertiary-low);
+ box-sizing: border-box;
+ margin: 15px 0;
+
+ span.close {
+ float: right;
+ }
+}
diff --git a/plugins/discourse-patreon/config/locales/client.ar.yml b/plugins/discourse-patreon/config/locales/client.ar.yml
new file mode 100644
index 00000000000..1b08d278cea
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.ar.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ar:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Discourse Patreon"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: تسجيل الدخول باستخدام Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'المرشحات'
+ group: 'مجموعة'
+ rewards: 'المكافآت'
+ filter: 'مرشح'
+ help_text: 'يمكنك مزامنة مجموعة Discourse مع واحدة أو أكثر من درجات مكافآت Patreon'
+ last_synced: 'آخر مزامنة'
+ edit: 'تعديل'
+ delete: 'حذف'
+ save: 'حفظ'
+ update_data: 'تحديث بيانات Patreon ومجموعات المزامنة'
+ refresh_page: 'تم تنزيل بيانات جديدة من Patreon API. يُرجى تحديث الصفحة.'
+ select_group: 'تحديد مجموعة'
+ field:
+ id: "المُعرِّف"
+ email: "البريد الإلكتروني"
+ amount_cents: "المبلغ (بالسنت)"
+ rewards: "المكافآت"
+ declined_since: "تم رفض التبرع منذ"
+ more_details:
+ label: "المدفوعات والمزيد من التفاصيل"
+ help_text:
+ email_available: "أنظر أسفل يمين الصفحة لعرض سجل تبرعات Patreon هذا."
+ email_not_available: "حدِّد عضو Patreon وانظر أسفل يمين الصفحة لعرض سجل التبرعات."
+ donation_prompt:
+ body: |
+ <h1>مرحبًا أيها القارئ!</h1>
+
+ <p>هل يعجبك موقعنا؟ هل ترغب في التبرع لصالح قضية جيدة؟</p>
+
+ <p>
+ إذا كنت تجد موقعنا مفيدًا وتستمتع بالمجتمع الذي أنشأناه، فسنسعد كثيرًا بتبرعك لموقعنا.
+ تحافظ التبرعات على تشغيل خدماتنا بسلاسة وتضمن استمرار مجتمعنا في العمل لسنوات قادمة.
+ كل دولار يصنع الفارق وسيتم توظيفه جيدًا.
+ </p>
+
+ <p>شكرًا لك على دعمك!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">انضم إلى الرعاة</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.be.yml b/plugins/discourse-patreon/config/locales/client.be.yml
new file mode 100644
index 00000000000..63b83dbc868
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.be.yml
@@ -0,0 +1,16 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+be:
+ js:
+ patreon:
+ group: 'Група'
+ filter: 'Filter'
+ edit: 'Рэдагаваць'
+ delete: 'Выдаліць'
+ save: 'Захаваць'
+ field:
+ email: "электронная пошта"
diff --git a/plugins/discourse-patreon/config/locales/client.bg.yml b/plugins/discourse-patreon/config/locales/client.bg.yml
new file mode 100644
index 00000000000..ed1b3bee8d6
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.bg.yml
@@ -0,0 +1,16 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+bg:
+ js:
+ patreon:
+ group: 'Група'
+ filter: 'Филтер'
+ edit: 'Редактирай'
+ delete: 'Изтрий'
+ save: 'Запази'
+ field:
+ email: "Имейл"
diff --git a/plugins/discourse-patreon/config/locales/client.bs_BA.yml b/plugins/discourse-patreon/config/locales/client.bs_BA.yml
new file mode 100644
index 00000000000..8b8a1173b62
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.bs_BA.yml
@@ -0,0 +1,16 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+bs_BA:
+ js:
+ patreon:
+ group: 'Grupa'
+ filter: 'Filter'
+ edit: 'Izmijeni'
+ delete: 'Delete'
+ save: 'Sačuvaj'
+ field:
+ email: "Email"
diff --git a/plugins/discourse-patreon/config/locales/client.ca.yml b/plugins/discourse-patreon/config/locales/client.ca.yml
new file mode 100644
index 00000000000..318b252f4be
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.ca.yml
@@ -0,0 +1,36 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ca:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtres'
+ group: 'Grup'
+ rewards: 'Recompenses'
+ filter: 'Filtre'
+ help_text: 'Podeu sincronitzar un grup de Discourse amb un o més nivells de recompensa de Patreon.'
+ last_synced: 'Última sincronització'
+ edit: 'Edita'
+ delete: 'Suprimeix'
+ save: 'Desa'
+ update_data: 'Actualitza les dades de Patreon i sincronitza els grups'
+ refresh_page: 'S''han descarregat dades noves de l''API de Patreon. Actualitzeu la pàgina.'
+ field:
+ id: "Id"
+ email: "Correu electrònic"
+ amount_cents: "Quantitat (en cèntims)"
+ rewards: "Recompenses"
+ declined_since: "Compromís refusat des de"
+ more_details:
+ label: "Pagaments i més detalls"
+ help_text:
+ email_available: "Aneu a la part inferior dreta de la pàgina per a veure l'historial de compromís de Patreon."
+ email_not_available: "Seleccioneu el membre de Patreon i aneu a la part inferior dreta de la pàgina per a veure l'historial de compromisos."
diff --git a/plugins/discourse-patreon/config/locales/client.cs.yml b/plugins/discourse-patreon/config/locales/client.cs.yml
new file mode 100644
index 00000000000..9f16a4ad29e
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.cs.yml
@@ -0,0 +1,24 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+cs:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtry'
+ group: 'Skupina'
+ rewards: 'Odměny'
+ filter: 'Filtr'
+ edit: 'Upravit'
+ delete: 'Smazat'
+ save: 'Uložit'
+ field:
+ email: "Email"
+ rewards: "Odměny"
diff --git a/plugins/discourse-patreon/config/locales/client.da.yml b/plugins/discourse-patreon/config/locales/client.da.yml
new file mode 100644
index 00000000000..0e34b12d386
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.da.yml
@@ -0,0 +1,16 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+da:
+ js:
+ patreon:
+ group: 'Gruppe'
+ filter: 'Filter'
+ edit: 'Rediger'
+ delete: 'Slet'
+ save: 'Gem'
+ field:
+ email: "Email"
diff --git a/plugins/discourse-patreon/config/locales/client.de.yml b/plugins/discourse-patreon/config/locales/client.de.yml
new file mode 100644
index 00000000000..4137a923180
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.de.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+de:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Discourse – Patreon"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Mit Patreon anmelden
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filter'
+ group: 'Gruppe'
+ rewards: 'Belohnungen'
+ filter: 'Filter'
+ help_text: 'Du kannst eine Discourse-Gruppe mit einer oder mehreren Patreon-Belohnungsstufen synchronisieren.'
+ last_synced: 'Zuletzt synchronisiert'
+ edit: 'Bearbeiten'
+ delete: 'Löschen'
+ save: 'Speichern'
+ update_data: 'Patreon-Daten aktualisieren und Gruppen synchronisieren'
+ refresh_page: 'Neue Daten wurden über die Patreon-API heruntergeladen. Bitte lade die Seite neu.'
+ select_group: 'Gruppe auswählen'
+ field:
+ id: "ID"
+ email: "E-Mail"
+ amount_cents: "Betrag (in Cent)"
+ rewards: "Belohnungen"
+ declined_since: "Spende abgelehnt seit"
+ more_details:
+ label: "Zahlungen und weitere Details"
+ help_text:
+ email_available: "Gehe nach unten rechts auf der Seite, um den Verlauf der Patreon-Spenden zu sehen."
+ email_not_available: "Wähle das Patreon-Mitglied aus und gehe auf der Seite nach unten rechts, um den Verlauf der Patreon-Spenden zu sehen."
+ donation_prompt:
+ body: |
+ <h1>Hallo, Leser!</h1>
+
+ <p>Gefällt dir unsere Website? Möchtest du einen Beitrag zu einem guten Zweck leisten?</p>
+
+ <p>
+ Wenn du unsere Website hilfreich findest und dir die Community gefällt, die wir geschaffen haben, würden wir uns freuen, wenn du für unsere Website spendest.
+ Spenden sorgen dafür, dass unsere Dienste reibungslos funktionieren und dass unsere Community auch in den nächsten Jahren weiterbestehen kann.
+ Jeder Euro zählt und wird sinnvoll eingesetzt.
+ </p>
+
+ <p>Dankeschön für deine Unterstützung!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Patron werden</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.el.yml b/plugins/discourse-patreon/config/locales/client.el.yml
new file mode 100644
index 00000000000..ed4ea5ef45f
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.el.yml
@@ -0,0 +1,26 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+el:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Φίλτρα'
+ group: 'Ομάδα'
+ rewards: 'Ανταμοιβές'
+ filter: 'Φίλτρο'
+ help_text: 'Μπορείτε να συγχρονίσετε μια ομάδα Discourse με ένα ή περισσότερα επίπεδα ανταμοιβής Patreon.'
+ edit: 'Επεξεργασία'
+ delete: 'Σβήσιμο'
+ save: 'Αποθήκευση'
+ field:
+ email: "Διεύθυνση Email"
+ amount_cents: "Ποσό (σε λεπτά)"
+ rewards: "Ανταμοιβές"
diff --git a/plugins/discourse-patreon/config/locales/client.en.yml b/plugins/discourse-patreon/config/locales/client.en.yml
new file mode 100644
index 00000000000..4c6dd0c45a4
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.en.yml
@@ -0,0 +1,54 @@
+en:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Discourse Patreon"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Log in with Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filters'
+ group: 'Group'
+ rewards: 'Rewards'
+ filter: 'Filter'
+ help_text: 'You can sync a Discourse group with one or more Patreon reward tiers.'
+ last_synced: 'Last Synced'
+ edit: 'Edit'
+ delete: 'Delete'
+ save: 'Save'
+ update_data: 'Update Patreon Data & Sync Groups'
+ refresh_page: 'New data has been downloaded from Patreon API. Please refresh the page.'
+ select_group: 'Select a group'
+ field:
+ id: "Id"
+ email: "Email"
+ amount_cents: "Amount (in cents)"
+ rewards: "Rewards"
+ declined_since: "Pledge Declined Since"
+ more_details:
+ label: "Payments & More Details"
+ help_text:
+ email_available: "Reach bottom right of the page to see this Patreon's pledge history."
+ email_not_available: "Select the Patreon member and reach bottom right of the page to see the pledge history."
+ donation_prompt:
+ body: |
+ <h1>Hello reader!</h1>
+
+ <p>Do you like our website? Would you like to contribute to a good cause?</p>
+
+ <p>
+ If find our website helpful and enjoy the community we've created, we would love if you donated to our website.
+ Donations keep our services running smoothly and ensures that our community will be operational for years to come.
+ Every dollar counts and will be put to good use.
+ </p>
+
+ <p>Thank you for your support!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Become a Patron</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.en_GB.yml b/plugins/discourse-patreon/config/locales/client.en_GB.yml
new file mode 100644
index 00000000000..2d4fa180ec7
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.en_GB.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+en_GB:
diff --git a/plugins/discourse-patreon/config/locales/client.es.yml b/plugins/discourse-patreon/config/locales/client.es.yml
new file mode 100644
index 00000000000..eaebb9f31b0
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.es.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+es:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Patreon de Discourse"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Iniciar sesión con Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtros'
+ group: 'Grupo'
+ rewards: 'Recompensas'
+ filter: 'Filtro'
+ help_text: 'Puedes sincronizar un grupo de Discourse con uno o varios niveles de recompensa Patreon.'
+ last_synced: 'Última sincronización'
+ edit: 'Editar'
+ delete: 'Eliminar'
+ save: 'Guardar'
+ update_data: 'Actualizar datos de Patreon y sincronizar grupos'
+ refresh_page: 'Se han descargado nuevos datos desde la API de Patreon. Actualiza la página.'
+ select_group: 'Selecciona un grupo'
+ field:
+ id: "ID"
+ email: "Correo electrónico"
+ amount_cents: "Cantidad (en céntimos)"
+ rewards: "Recompensas"
+ declined_since: "Promesa rechazada desde"
+ more_details:
+ label: "Pagos y más detalles"
+ help_text:
+ email_available: "Ve a la parte inferior derecha de la página para ver el historial de promesas de Patreon."
+ email_not_available: "Selecciona el miembro de Patreon y ve a la parte inferior derecha de la página para ver el historial de promesas."
+ donation_prompt:
+ body: |
+ <h1>¡Hola lector!</h1>
+
+ <p>¿Te gusta nuestro sitio web? ¿Quieres contribuir a una buena causa?</p>
+
+ <p>
+ Si nuestro sitio web te resulta útil y disfrutas de la comunidad que hemos creado, nos encantaría que hicieras una donación a nuestro sitio web.
+ Las donaciones mantienen nuestros servicios en funcionamiento y garantizan que nuestra comunidad esté operativa durante años.
+ Cada dólar cuenta y se le dará un buen uso.
+ </p>
+
+ <p>¡Gracias por tu apoyo!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Hazte mecenas</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.et.yml b/plugins/discourse-patreon/config/locales/client.et.yml
new file mode 100644
index 00000000000..7652f470d46
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.et.yml
@@ -0,0 +1,22 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+et:
+ js:
+ patreon:
+ header:
+ rules: 'Filtrid'
+ group: 'Grupp'
+ rewards: 'Autasud'
+ filter: 'Filter'
+ last_synced: 'Viimati sünkroonitud'
+ edit: 'Muuda'
+ delete: 'Kustuta'
+ save: 'Salvesta'
+ field:
+ id: "D"
+ email: "E-post"
+ rewards: "Autasud"
diff --git a/plugins/discourse-patreon/config/locales/client.fa_IR.yml b/plugins/discourse-patreon/config/locales/client.fa_IR.yml
new file mode 100644
index 00000000000..74e325ab222
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.fa_IR.yml
@@ -0,0 +1,29 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fa_IR:
+ js:
+ login:
+ patreon:
+ name: پاترئون
+ patreon:
+ title: 'پاترون'
+ header:
+ rules: 'فیلترها'
+ group: 'گروه'
+ rewards: 'پاداش'
+ filter: 'فیلتر'
+ edit: 'ویرایش'
+ delete: 'حذف'
+ save: 'ذخیره'
+ select_group: 'یک گروه را انتخاب کنید'
+ field:
+ id: "شناسه"
+ email: "ایمیل"
+ amount_cents: "مقدار (به سنت)"
+ rewards: "پاداش"
+ more_details:
+ label: "پرداخت‌ها و جزئیات بیشتر"
diff --git a/plugins/discourse-patreon/config/locales/client.fi.yml b/plugins/discourse-patreon/config/locales/client.fi.yml
new file mode 100644
index 00000000000..03a17fabd1f
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.fi.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fi:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Discourse Patreon"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Kirjaudu Patreonilla
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Suodattimet'
+ group: 'Ryhmä'
+ rewards: 'Palkinnot'
+ filter: 'Suodatin'
+ help_text: 'Voit synkronoida Discourse-ryhmän yhteen tai useampaan Patreon-palkintotasoon.'
+ last_synced: 'Viimeksi synkronisoitu'
+ edit: 'Muokkaa'
+ delete: 'Poista'
+ save: 'Tallenna'
+ update_data: 'Päivitä Patreonin tiedot ja synkronoi ryhmät'
+ refresh_page: 'Uusia tietoja on ladattu Patreonin APIsta. Päivitä sivu.'
+ select_group: 'Valitse ryhmä'
+ field:
+ id: "Tunnus"
+ email: "Sähköposti"
+ amount_cents: "Määrä (senteissä)"
+ rewards: "Palkinnot"
+ declined_since: "Lahjoituslupaus peruttu alkaen"
+ more_details:
+ label: "Maksut ja muita tietoja"
+ help_text:
+ email_available: "Selaa oikeaan alareunaan nähdäksesi tämän Patreonin lahjoituslupaushistoria."
+ email_not_available: "Valitse Patreon-jäsen ja selaa oikeaan alakulmaan nähdäksesi lahjoituslupaushistorian."
+ donation_prompt:
+ body: |
+ <h1>Hei lukija!</h1>
+
+ <p>Pidätkö verkkosivustostamme? Haluaisitko osallistua hyvään tarkoitukseen?</p>
+
+ <p>
+ Jos verkkosivustomme on mielestäsi hyödyllinen ja pidät luomastamme yhteisöstä, olisimme iloisia, jos antaisit lahjoituksen verkkosivustollemme.
+ Lahjoitukset pitävät palvelumme käynnissä ja varmistavat, että yhteisömme jatkaa toimintaansa tulevina vuosina.
+ Jokainen dollari on tärkeä ja laitetaan hyvään käyttöön.
+ </p>
+
+ <p>Kiitos tuestasi!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Ryhdy tukijaksi</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.fr.yml b/plugins/discourse-patreon/config/locales/client.fr.yml
new file mode 100644
index 00000000000..cea11573ecb
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.fr.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fr:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Patreon de Discourse"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Se connecter avec Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtres'
+ group: 'Groupe'
+ rewards: 'Récompenses'
+ filter: 'Filtre'
+ help_text: 'Vous pouvez synchroniser un groupe Discourse avec un ou plusieurs niveaux de récompense Patreon.'
+ last_synced: 'Dernière synchronisation'
+ edit: 'Modifier'
+ delete: 'Supprimer'
+ save: 'Enregistrer'
+ update_data: 'Mettre à jour les données Patreon et synchroniser les groupes'
+ refresh_page: 'Des nouvelles données ont été téléchargées depuis l''API Patreon. Veuillez actualiser la page.'
+ select_group: 'Sélectionner un groupe'
+ field:
+ id: "ID"
+ email: "E-mail"
+ amount_cents: "Montant (en cents)"
+ rewards: "Récompenses"
+ declined_since: "Promesse de don refusée depuis le"
+ more_details:
+ label: "Paiements et autres détails"
+ help_text:
+ email_available: "Vous trouverez l'historique des promesses de don de ce Patreon en bas à droite de cette page."
+ email_not_available: "Sélectionnez le membre Patreon et accédez à l'historique des promesses de dons en bas à droite de la page."
+ donation_prompt:
+ body: |
+ <h1>Bonjour lecteur !</h1>
+
+ <p>Appréciez-vous notre site ? Souhaitez-vous soutenir une bonne cause ?</p>
+
+ <p>
+ Si vous trouvez ce site utile et appréciez la communauté que nous avons formée, nous serions ravis de recevoir vos dons.
+ Les donations permettent le bon fonctionnement de notre service et garantissent que notre communauté reste active pour les années à venir.
+ Chaque montant est important et sera utilisé à bon escient.
+ </p>
+
+ <p>Merci pour votre soutien !<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Devenir mécène</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.gl.yml b/plugins/discourse-patreon/config/locales/client.gl.yml
new file mode 100644
index 00000000000..e055ca9e013
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.gl.yml
@@ -0,0 +1,54 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+gl:
+ js:
+ login:
+ patreon:
+ name: Patreón
+ patreon:
+ title: 'Patreón'
+ header:
+ rules: 'Filtros'
+ group: 'Grupo'
+ rewards: 'Recompensas'
+ filter: 'Filtro'
+ help_text: 'Pode sincronizar un grupo de Discourse cun ou máis niveis de recompensa de Patreon.'
+ last_synced: 'Última sincronización'
+ edit: 'Editar'
+ delete: 'Eliminar'
+ save: 'Gardar'
+ update_data: 'Actualizar os datos de Patreon e sincronizar os grupos'
+ refresh_page: 'Descargáronse novos datos da API de Patreon. Actualice a páxina.'
+ select_group: 'Seleccione un grupo'
+ field:
+ id: "Id"
+ email: "Correo electrónico"
+ amount_cents: "Cantidade (en céntimos)"
+ rewards: "Recompensas"
+ declined_since: "Compromiso rexeitado dende"
+ more_details:
+ label: "Pagamentos e máis detalles"
+ help_text:
+ email_available: "Acceda á parte inferior dereita da páxina para ver o historial de compromisos deste Patreon."
+ email_not_available: "Seleccione o membro de Patreon e acceda co botón da parte inferior dereita da páxina para ver o historial de promesas."
+ donation_prompt:
+ body: |
+ <h1>Ola lector!</h1>
+
+ <p>Gústalle o noso sitio? Gustaríalle contribuír a unha boa causa?</p>
+
+ <p>
+ Se atopa de utilidade o sitio e lle resulta atractiva a comunidade que fomos creando, estariamos encantados se doase ao noso sitio.
+ As doazóns manteñen o noso servizo funcionando normalmente e asegura que a nosa comunidade estará operativa nos vindeiros anos.
+ Cada moeda conta e faremos bo uso delas.
+ </p>
+
+ <p>Grazas polo seu apoio!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Fágase Patron</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.he.yml b/plugins/discourse-patreon/config/locales/client.he.yml
new file mode 100644
index 00000000000..eae36b5fad5
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.he.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+he:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Discourse Patreon"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: כניסה עם פטראון
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'מסננים'
+ group: 'קבוצה'
+ rewards: 'פרסים'
+ filter: 'מסנן'
+ help_text: 'ניתן לסנכרן קבוצת Discourse עם שכבה אחת או יותר של פרסים מ־Patreon.'
+ last_synced: 'נסכרון אחרון'
+ edit: 'עריכה'
+ delete: 'מחיקה'
+ save: 'שמירה'
+ update_data: 'עדכון הנתונים של Patreon וסנכרון הקבוצות'
+ refresh_page: 'התקבלו נתונים חדשים מה־API של Patreon. נא לרענן את העמוד.'
+ select_group: 'בחירת קבוצה'
+ field:
+ id: "מזהה"
+ email: "דוא״ל"
+ amount_cents: "כמות (בסנטים)"
+ rewards: "פרסים"
+ declined_since: "ההבטחה נדחתה מאז"
+ more_details:
+ label: "תשלומים ופרטים נוספים"
+ help_text:
+ email_available: "ניתן להגיע לפינה הימנית התחתונה של העמוד כדי לצפות בהיסטוריית ההבטחות של ה־Patreon הזה."
+ email_not_available: "נא לבחור בחבר ב־Patreon ולהגיע לפינה הימנית התחתונה של העמוד כדי לצפות בהיסטוריית ההבטחות."
+ donation_prompt:
+ body: |
+ <h1>שלום לקוראינו!</h1>
+
+ <p>איך האתר שלנו? מעניין אותך לתרום למטרה טובה?</p>
+
+ <p>
+ אם לדעתך האתר שלנו מועיל והקהילה שבנינו נאה בעיניך, נשמח לבקש ממך לתרום לאתר שלנו.
+ התרומות דואגות לכך שהשירותים ימשיכו לפעול בצורה איכותית ויעילה ומבטיחה את פעילות הקהילה שלנו גם לשנים הבאות.
+ כל דולר נחשב והוא ישמש למטרה טובה.
+ </p>
+
+ <p>תודה על תמיכתך!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">הפיכה ל־Patreon</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.hr.yml b/plugins/discourse-patreon/config/locales/client.hr.yml
new file mode 100644
index 00000000000..11225d3a2e2
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.hr.yml
@@ -0,0 +1,36 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hr:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filteri'
+ group: 'Grupa'
+ rewards: 'Nagrade'
+ filter: 'Filter'
+ help_text: 'Grupu na Discourseu možete sinkronizirati s jednim ili više rangova nagrada na Patreonu'
+ last_synced: 'Posljednji put sinkronizirano'
+ edit: 'Izmijeni'
+ delete: 'Pobriši'
+ save: 'Spremi'
+ update_data: 'Ažuriraj podatke Patreona i sinkroniziraj grupe'
+ refresh_page: 'Novi podaci prezueti su s Pateron API-ja. Molimo osvježite stranicu.'
+ field:
+ id: "Id"
+ email: "Email"
+ amount_cents: "Iznos (u centima)"
+ rewards: "Nagrade"
+ declined_since: "Zalog odbijen od"
+ more_details:
+ label: "Plaćanja i detalji"
+ help_text:
+ email_available: "Navigirajte do dna ove stranice kako bi vidjeli povijest Patreon zaloga."
+ email_not_available: "Odaberite Pateron člana i navigirajte do dna stranice kako bi pregledali povijest zaloga."
diff --git a/plugins/discourse-patreon/config/locales/client.hu.yml b/plugins/discourse-patreon/config/locales/client.hu.yml
new file mode 100644
index 00000000000..c402c0074c0
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.hu.yml
@@ -0,0 +1,26 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hu:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Szűrők'
+ group: 'Csoport'
+ rewards: 'Jutalmak'
+ filter: 'Szűr'
+ last_synced: 'Utoljára szinkronizálva'
+ edit: 'Szerkeszt'
+ delete: 'Töröl'
+ save: 'Mentés'
+ field:
+ id: "Id"
+ email: "Email"
+ rewards: "Jutalmak"
diff --git a/plugins/discourse-patreon/config/locales/client.hy.yml b/plugins/discourse-patreon/config/locales/client.hy.yml
new file mode 100644
index 00000000000..f36fd5986b6
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.hy.yml
@@ -0,0 +1,36 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hy:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Ֆիլտրներ'
+ group: 'Խմբավորել'
+ rewards: 'Պարգևատրումներ'
+ filter: 'Ֆիլտրել'
+ help_text: 'Դուք կարող եք համաժամանակեցնել Discourse խումբ մեկ կամ ավելի Patreon պարգևատրման աստիճանների հետ:'
+ last_synced: 'Վերջին անգամ Համաժամանակեցվել է'
+ edit: 'Խմբագրել'
+ delete: 'Ջնջել'
+ save: 'Պահպանել'
+ update_data: 'Թարմացնել Patreon -ի Տվյալները և Համաժամանակեցնել Խմբերը'
+ refresh_page: 'Patreon API -ից ներբեռնվել են նոր տվյալներ: Խնդրում ենք թարմացնել էջը:'
+ field:
+ id: "Id"
+ email: "Էլ. հասցե"
+ amount_cents: "Քանակ (ցենտով)"
+ rewards: "Պարգևատրումներ"
+ declined_since: "Երաշխիքի Մերժման Պատճառ՝"
+ more_details:
+ label: "Վճարումներ և Մանրամասն Տեղեկություններ"
+ help_text:
+ email_available: "Իջեք դեպի էջի ներքևի աջ կողմ՝ այս Patreon-ի երաշխիքի պատմությունը դիտելու համար"
+ email_not_available: "Ընտրել Patreon անդամի և իջնել դեպի էջի ներքևի աջ կողմ՝ երաշխիքի պատմությունը դիտելու համար:"
diff --git a/plugins/discourse-patreon/config/locales/client.id.yml b/plugins/discourse-patreon/config/locales/client.id.yml
new file mode 100644
index 00000000000..86fb5ed25df
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.id.yml
@@ -0,0 +1,15 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+id:
+ js:
+ patreon:
+ filter: 'Filter'
+ edit: 'Ubah'
+ delete: 'Hapus'
+ save: 'Simpan'
+ field:
+ email: "Email"
diff --git a/plugins/discourse-patreon/config/locales/client.it.yml b/plugins/discourse-patreon/config/locales/client.it.yml
new file mode 100644
index 00000000000..c0156ac8c99
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.it.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+it:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Discourse Patreon"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Accedi con Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtri'
+ group: 'Gruppo'
+ rewards: 'Ricompense'
+ filter: 'Filtro'
+ help_text: 'Puoi sincronizzare un gruppo Discourse con uno o più livelli di ricompense di Patreon.'
+ last_synced: 'Ultima Sincronizzazione'
+ edit: 'Modifica'
+ delete: 'Cancella'
+ save: 'Salva'
+ update_data: 'Aggiorna Dati Patreon & Sincronizza Gruppi'
+ refresh_page: 'Nuovi dati sono stati scaricati dall''API Patreon. Si prega di aggiornare la pagina.'
+ select_group: 'Seleziona un gruppo'
+ field:
+ id: "Id"
+ email: "Email"
+ amount_cents: "Importo (in centesimi)"
+ rewards: "Ricompense"
+ declined_since: "Promessa di donazione rifiutata dal"
+ more_details:
+ label: "Pagamenti e altri dettagli"
+ help_text:
+ email_available: "Raggiungi la parte in basso a destra della pagina per vedere la cronologia delle donazioni di Patreon."
+ email_not_available: "Seleziona il membro Patreon e raggiungi la parte in basso a destra della pagina per vedere la cronologia delle donazioni."
+ donation_prompt:
+ body: |
+ <h1>Caro lettore, benvenuto!</h1>
+
+ <p>Ti piace il nostro sito web? Vuoi contribuire a una buona causa?</p>
+
+ <p>
+ Se trovi utile il nostro sito web e ti piace la community che abbiamo creato, ti saremmo molto grati se tu volessi fare una donazione al nostro sito web.
+ Le donazioni garantiscono il buon funzionamento dei nostri servizi e assicurano l'operatività della nostra community negli anni a venire.
+ Anche la più piccola somma è importante e sarà messa a frutto.
+ </p>
+
+ <p>Grazie per il tuo sostegno!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Diventa un nostro sostenitore</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.ja.yml b/plugins/discourse-patreon/config/locales/client.ja.yml
new file mode 100644
index 00000000000..2b9aa4ac5fc
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.ja.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ja:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Discourse Patreon"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Patreon でログイン
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'フィルター'
+ group: 'グループ'
+ rewards: '報酬'
+ filter: 'フィルター'
+ help_text: 'Discourse グループを 1 つ以上の Patreon 報酬ランクと同期できます。'
+ last_synced: '最終同期'
+ edit: '編集'
+ delete: '削除'
+ save: '保存'
+ update_data: 'Patreon データを更新してグループを同期'
+ refresh_page: 'Patreon API から新しいデータがダウンロードされました。ページを更新してください。'
+ select_group: 'グループを選択'
+ field:
+ id: "ID"
+ email: "メールアドレス"
+ amount_cents: "金額(セント単位)"
+ rewards: "報酬"
+ declined_since: "誓約拒否"
+ more_details:
+ label: "支払いとその他の詳細"
+ help_text:
+ email_available: "ページの右下に移動し、この Patreon の誓約履歴を確認してください。"
+ email_not_available: "Patreon メンバーを選択し、ページの右下に移動して、誓約履歴を確認してください。"
+ donation_prompt:
+ body: |
+ <h1>皆さん、こんにちは!</h1>
+
+ <p>私たちのウェブサイトを気に入っていただけていますでしょうか?慈善活動に貢献したいと思いませんか?</p>
+
+ <p>
+ 私たちのウェブサイトがあなたの役に立っており、コミュニティーをお楽しみいただいているのであれば、このウェブサイトに寄付していただければ幸いです。
+ 今後数年に渡って、私たちのサービスとコミュニティーの運営を円滑に維持していくには、皆さんからの寄付が必要です。
+ 皆さんからの 1 円 1 円を大切に利用させていただきます。
+ </p>
+
+ <p>皆さんのご支援をお待ちしております!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">パトロンになる</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.ko.yml b/plugins/discourse-patreon/config/locales/client.ko.yml
new file mode 100644
index 00000000000..6afaf50721b
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.ko.yml
@@ -0,0 +1,37 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ko:
+ js:
+ login:
+ patreon:
+ name: 파트 레온
+ patreon:
+ title: '파트 레온'
+ header:
+ rules: '필터'
+ group: '그룹'
+ rewards: '보상'
+ filter: '필터'
+ help_text: 'Discourse 그룹을 하나 이상의 Patreon 보상 계층과 동기화 할 수 있습니다.'
+ last_synced: '마지막 동기화'
+ edit: '수정'
+ delete: '삭제'
+ save: '저장'
+ update_data: 'Patreon 데이터 및 동기화 그룹 업데이트'
+ refresh_page: 'Patreon API에서 새 데이터가 다운로드되었습니다. 페이지를 새로 고침하십시오.'
+ select_group: '그룹을 선택하세요'
+ field:
+ id: "신분증"
+ email: "이메일"
+ amount_cents: "금액 (센트)"
+ rewards: "보상"
+ declined_since: "이후 거부 된 서약"
+ more_details:
+ label: "지불 및 자세한 내용"
+ help_text:
+ email_available: "이 Patreon의 서약 내역을 보려면 페이지 오른쪽 하단에 도달하십시오."
+ email_not_available: "Patreon 회원을 선택하고 페이지 오른쪽 하단에 도달하여 서약 내역을 확인하십시오."
diff --git a/plugins/discourse-patreon/config/locales/client.lt.yml b/plugins/discourse-patreon/config/locales/client.lt.yml
new file mode 100644
index 00000000000..ca530c6c8e8
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.lt.yml
@@ -0,0 +1,22 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+lt:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtrai'
+ group: 'Grupė'
+ filter: 'Filtruoti'
+ edit: 'Redaguoti'
+ delete: 'Pašalinti'
+ save: 'Saugoti'
+ field:
+ email: "Epaštas"
diff --git a/plugins/discourse-patreon/config/locales/client.lv.yml b/plugins/discourse-patreon/config/locales/client.lv.yml
new file mode 100644
index 00000000000..e9b06a9cd57
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.lv.yml
@@ -0,0 +1,16 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+lv:
+ js:
+ patreon:
+ group: 'Grupa'
+ filter: 'Filtrs'
+ edit: 'Labot'
+ delete: 'Dzēst'
+ save: 'Saglabāt'
+ field:
+ email: "E-pasts"
diff --git a/plugins/discourse-patreon/config/locales/client.nb_NO.yml b/plugins/discourse-patreon/config/locales/client.nb_NO.yml
new file mode 100644
index 00000000000..4269b0d6b2e
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.nb_NO.yml
@@ -0,0 +1,26 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+nb_NO:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filter'
+ group: 'Gruppe'
+ rewards: 'Belønninger'
+ filter: 'Filter'
+ help_text: 'Du kan synkronisere en Discourse-gruppe med én eller flere Patreon-belønningsnivåer.'
+ edit: 'Rediger'
+ delete: 'Slett'
+ save: 'Lagre'
+ update_data: 'Oppdater Patreon-data og synkroniser grupper'
+ field:
+ email: "E-post"
+ rewards: "Belønninger"
diff --git a/plugins/discourse-patreon/config/locales/client.nl.yml b/plugins/discourse-patreon/config/locales/client.nl.yml
new file mode 100644
index 00000000000..a6a2616e169
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.nl.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+nl:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Discourse Patreon"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Inloggen met Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filters'
+ group: 'Groep'
+ rewards: 'Beloningen'
+ filter: 'Filter'
+ help_text: 'Je kunt een Discourse-groep met een of meer Patreon-beloningsniveaus synchroniseren.'
+ last_synced: 'Laatst gesynchroniseerd'
+ edit: 'Bewerken'
+ delete: 'Verwijderen'
+ save: 'Opslaan'
+ update_data: 'Patreon-gegevens bijwerken en groepen synchroniseren'
+ refresh_page: 'Er zijn nieuwe gegevens gedownload via de Patreon-API. Vernieuw de pagina.'
+ select_group: 'Selecteer een groep'
+ field:
+ id: "ID"
+ email: "E-mailadres"
+ amount_cents: "Bedrag (in centen)"
+ rewards: "Beloningen"
+ declined_since: "Donatie geweigerd sinds"
+ more_details:
+ label: "Betalingen en meer details"
+ help_text:
+ email_available: "Bekijk de pagina rechtsonder om de donatiegeschiedenis van deze Patreon te zien."
+ email_not_available: "Selecteer het Patreon-lid en bekijk de pagina rechtsonder om de donatiegeschiedenis te zien."
+ donation_prompt:
+ body: |
+ <h1>Hallo lezer!</h1>
+
+ <p>Bevalt onze website? Wil je bijdragen aan een goed doel?</p>
+
+ <p>
+ Als je onze website nuttig vindt en geniet van de community die we hebben gecreëerd, zouden we het fijn vinden als je doneert aan onze website.
+ Donaties zorgen ervoor dat onze services soepel blijven werken en dat onze community nog jarenlang operationeel blijft.
+ Elke cent telt en wordt goed gebruikt.
+ </p>
+
+ <p>Bedankt voor je steun!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Patron worden</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.pl_PL.yml b/plugins/discourse-patreon/config/locales/client.pl_PL.yml
new file mode 100644
index 00000000000..747c68bf117
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.pl_PL.yml
@@ -0,0 +1,36 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pl_PL:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtry'
+ group: 'Grupa'
+ rewards: 'Nagrody'
+ filter: 'Filtr'
+ help_text: 'Możesz zsynchronizować grupę Discourse’a z jednym lub większą liczbą progów Patreona.'
+ last_synced: 'Ostatnio zsynchronizowane'
+ edit: 'Edytuj'
+ delete: 'Usuń'
+ save: 'Zapisz'
+ update_data: 'Zaktualizuj dane Patreona i zsynchronizuj grupy'
+ refresh_page: 'Nowe dane są pobierane przez API Patreona. Odśwież stronę.'
+ field:
+ id: "ID"
+ email: "Email"
+ amount_cents: "Liczba (w centach)"
+ rewards: "Nagrody"
+ declined_since: "Wpłata odrzucona od"
+ more_details:
+ label: "Płatność i szczegóły"
+ help_text:
+ email_available: "Sprawdź prawą dolną część strony, by zobaczyć historię wpłat Patreona."
+ email_not_available: "Wybierz użytkownika Patreona i sprawdź prawą dolną część strony, by zobaczyć historię wpłat."
diff --git a/plugins/discourse-patreon/config/locales/client.pt.yml b/plugins/discourse-patreon/config/locales/client.pt.yml
new file mode 100644
index 00000000000..1a3f6ff29c5
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.pt.yml
@@ -0,0 +1,28 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pt:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtros'
+ group: 'Grupo'
+ rewards: 'Recompensas'
+ filter: 'Filtrar'
+ help_text: 'Pode sincronizar um grupo do Discourse com uma ou mais camadas de recompensa do Patreon.'
+ edit: 'Editar'
+ delete: 'Eliminar'
+ save: 'Guardar'
+ update_data: 'Atualizar Dados de Patreon e Sincronizar Grupos'
+ refresh_page: 'Foram transferidos novos dados da API do Patreon. Por favor, atualize a página.'
+ field:
+ email: "E-mail"
+ amount_cents: "Valor (em cent.)"
+ rewards: "Recompensas"
diff --git a/plugins/discourse-patreon/config/locales/client.pt_BR.yml b/plugins/discourse-patreon/config/locales/client.pt_BR.yml
new file mode 100644
index 00000000000..5921310a85b
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.pt_BR.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pt_BR:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Patreon no Discourse"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Entrar com o Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtros'
+ group: 'Grupo'
+ rewards: 'Recompensas'
+ filter: 'Filtro'
+ help_text: 'Você pode sincronizar um grupo do Discourse com um ou mais níveis de recompensa do Patreon.'
+ last_synced: 'Último Sincronizado'
+ edit: 'Editar'
+ delete: 'Excluir'
+ save: 'Salvar'
+ update_data: 'Atualizar dados do Patreon e sincronizar grupos'
+ refresh_page: 'Novos dados foram baixados da API do Patreon. Atualize a página.'
+ select_group: 'Selecione um grupo'
+ field:
+ id: "Id"
+ email: "E-mail"
+ amount_cents: "Valor (em centavos)"
+ rewards: "Recompensas"
+ declined_since: "Compromisso Recusado Desde"
+ more_details:
+ label: "Pagamentos e mais detalhes"
+ help_text:
+ email_available: "Vá para o canto inferior direito da página para ver este histórico de compromissos do Patreon."
+ email_not_available: "Selecione o membro Patreon e vá para o canto inferior direito da página para ver o histórico de compromissos."
+ donation_prompt:
+ body: |
+ <h1>Olá, leitor!</h1>
+
+ <p>Você gosta do nosso site? Gostaria de contribuir para uma boa causa?</p>
+
+ <p>
+ Se achar nosso site útil e gosta da comunidade que criamos, nós adoraríamos que fizesse uma doação para nosso site.
+ Doações mantêm nossos serviços funcionando sem problemas e garantem que nossa comunidade estará operacional por muitos anos.
+ Cada dólar conta e será bem utilizado.
+ </p>
+
+ <p>Obrigado pelo seu apoio!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Torne-se um(a) Patrono(a)</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.ro.yml b/plugins/discourse-patreon/config/locales/client.ro.yml
new file mode 100644
index 00000000000..d1a239f1ffb
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.ro.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ro:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Discourse Patreon"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Conectare cu Pateron
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtre'
+ group: 'Grup'
+ rewards: 'Recompense'
+ filter: 'Filtru'
+ help_text: 'Poți sincroniza un grup Discourse cu unul sau mai multe niveluri de recompensă Patreon.'
+ last_synced: 'Ultima sincronizare'
+ edit: 'Editează'
+ delete: 'Șterge'
+ save: 'Salvează'
+ update_data: 'Actualizează date Patreon și sincronizează grupuri'
+ refresh_page: 'Date noi au fost descărcate din API-ul Patreon. Te rugăm să reîmprospătezi pagina.'
+ select_group: 'Selectează un grup'
+ field:
+ id: "ID"
+ email: "Email"
+ amount_cents: "Sumă (în cenți)"
+ rewards: "Recompense"
+ declined_since: "Angajament refuzat din"
+ more_details:
+ label: "Plăți și mai multe detalii"
+ help_text:
+ email_available: "Ajungi în dreapta jos a paginii pentru a vedea istoricul angajamentului acestui Patreon."
+ email_not_available: "Selectează membrul Patreon și ajungi în dreapta jos a paginii pentru a vedea istoricul angajamentului."
+ donation_prompt:
+ body: |
+ <h1>Salut cititorule!</h1>
+
+ <p>Îți place site-ul nostru? Vrei să contribui la o cauză bună?</p>
+
+ <p>
+ Dacă găsești site-ul nostru util și te bucuri de comunitatea pe care am creat-o, ne-ar plăcea dacă ai dona pentru site-ul nostru web.
+ Donațiile mențin serviciile noastre funcționale fără probleme și asigură operaționalitatea comunitatății noastre în anii următori.
+ Fiecare dolar contează și va fi folosit în scopuri bune.
+ </p>
+
+ <p>Îți mulțumim pentru sprijin!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Devino un Patron</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.ru.yml b/plugins/discourse-patreon/config/locales/client.ru.yml
new file mode 100644
index 00000000000..fb49450ec84
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.ru.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ru:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Patreon для Discourse"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Войти через Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Фильтры'
+ group: 'Группа'
+ rewards: 'Награда'
+ filter: 'Фильтр'
+ help_text: 'Вы можете синхронизировать группу Discourse с одним или несколькими уровнями вознаграждений Patreon.'
+ last_synced: 'Последняя синхронизация'
+ edit: 'Изменить'
+ delete: 'Удалить'
+ save: 'Сохранить'
+ update_data: 'Обновить данные на Patreon и синхронизировать группы'
+ refresh_page: 'Новые данные были загружены из Patreon API. Пожалуйста, обновите страницу.'
+ select_group: 'Выберите группу'
+ field:
+ id: "Id"
+ email: "Email"
+ amount_cents: "Сумма (в центах)"
+ rewards: "Награда"
+ declined_since: "Подписка отклонена с"
+ more_details:
+ label: "Платежи и более подробная информация"
+ help_text:
+ email_available: "Дойдите до правого нижнего края страницы Patreon, чтобы увидеть историю подписок."
+ email_not_available: "Выберите участника Patreon и дойдите до правого нижнего края страницы, чтобы увидеть историю подписок."
+ donation_prompt:
+ body: |
+ <h1> Привет, читатель! </h1>
+
+ <p> Вам нравится наш сайт? Хотели бы вы внести свой вклад в благое дело? </p>
+
+ <p>
+ Если наш веб-сайт окажется полезным, и вам понравится созданное нами сообщество, мы будем рады, если вы сделаете пожертвование.
+ Пожертвования обеспечивают бесперебойную работу наших служб и гарантируют, что наше сообщество будет функционировать в течение многих лет.
+ Каждый доллар имеет значение и будет полезен.
+ </p>
+
+ <p> Спасибо за Вашу поддержку! <p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Стать покровителем</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.sk.yml b/plugins/discourse-patreon/config/locales/client.sk.yml
new file mode 100644
index 00000000000..6d42b27ba1a
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.sk.yml
@@ -0,0 +1,21 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sk:
+ js:
+ patreon:
+ header:
+ rules: 'Filtre'
+ group: 'Skupina'
+ rewards: 'Odmeny'
+ filter: 'Filter'
+ edit: 'Upraviť'
+ delete: 'Odstrániť'
+ save: 'Uložiť'
+ field:
+ id: "Id"
+ email: "Email"
+ rewards: "Odmena"
diff --git a/plugins/discourse-patreon/config/locales/client.sl.yml b/plugins/discourse-patreon/config/locales/client.sl.yml
new file mode 100644
index 00000000000..1501c3341e4
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.sl.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sl:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtri'
+ group: 'Skupina'
+ rewards: 'Nagrade'
+ filter: 'Filter'
+ help_text: 'Discourse skupino lahko sinhronizirate z eno ali več nagradnimi stopnjami v Patreonu.'
+ last_synced: 'Nazadnje sinhronizirano'
+ edit: 'Uredi'
+ delete: 'Izbriši'
+ save: 'Shrani'
+ update_data: 'Posodobi Patreon podatke & sinhroniziraj skupine'
+ field:
+ id: "Id"
+ email: "Email"
+ amount_cents: "Vrednost (v centih)"
+ rewards: "Nagrade"
+ more_details:
+ label: "Plačila & več podatkov"
diff --git a/plugins/discourse-patreon/config/locales/client.sq.yml b/plugins/discourse-patreon/config/locales/client.sq.yml
new file mode 100644
index 00000000000..7cc27eb32b9
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.sq.yml
@@ -0,0 +1,16 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sq:
+ js:
+ patreon:
+ group: 'Grupi'
+ filter: 'Filtro'
+ edit: 'Redakto'
+ delete: 'Fshij'
+ save: 'Ruaj'
+ field:
+ email: "Email"
diff --git a/plugins/discourse-patreon/config/locales/client.sr.yml b/plugins/discourse-patreon/config/locales/client.sr.yml
new file mode 100644
index 00000000000..ca72da81524
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.sr.yml
@@ -0,0 +1,16 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sr:
+ js:
+ patreon:
+ group: 'Grupa'
+ filter: 'Filter'
+ edit: 'Izmeni'
+ delete: 'Obriši'
+ save: 'Sačuvaj'
+ field:
+ email: "E-mail"
diff --git a/plugins/discourse-patreon/config/locales/client.sv.yml b/plugins/discourse-patreon/config/locales/client.sv.yml
new file mode 100644
index 00000000000..bbdf6ce35d4
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.sv.yml
@@ -0,0 +1,54 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sv:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filter'
+ group: 'Grupp'
+ rewards: 'Belöningar'
+ filter: 'Filter'
+ help_text: 'Du kan synkronisera en Discourse-grupp med en eller flera Patreon-belöningsnivåer.'
+ last_synced: 'Senast synkroniserad'
+ edit: 'Redigera'
+ delete: 'Radera'
+ save: 'Spara'
+ update_data: 'Uppdatera Patreon-data och synkronisera grupper'
+ refresh_page: 'Ny data har laddats ner från Patreon-API:n. Uppdatera sidan.'
+ select_group: 'Välj en grupp'
+ field:
+ id: "ID"
+ email: "E-post"
+ amount_cents: "Belopp (i cent)"
+ rewards: "Belöningar"
+ declined_since: "Donation nekad sedan"
+ more_details:
+ label: "Betalningar och mer detaljer"
+ help_text:
+ email_available: "Längst ner till höger på sidan ser du den här Patreonens donationshistorik."
+ email_not_available: "Välj Patreon-medlemmen och gå längst ner till höger på sidan för att se donationshistoriken."
+ donation_prompt:
+ body: |
+ <h1>Hej på dig som läser detta!</h1>
+
+ <p>Gillar du vår webbplats? Vill du bidra till ett gott ändamål?</p>
+
+ <p>
+ Om du tycker att vår webbplats är till nytta, och använder dig av det forum som vi har skapat, skulle vi bli glada om du donerade till webbplatsen.
+ Donationer är det som ser till att våra tjänster fungerar smidigt och säkerställer att vårt forum fungerar under många år framöver.
+ Varje krona räknas och kommer till god användning.
+ </p>
+
+ <p>Tack för ditt stöd!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Bli Patreon</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.sw.yml b/plugins/discourse-patreon/config/locales/client.sw.yml
new file mode 100644
index 00000000000..59e8191c135
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.sw.yml
@@ -0,0 +1,28 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sw:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Inachujwa'
+ group: 'Kikundi'
+ rewards: 'Tuzo'
+ filter: 'Ichujwe'
+ last_synced: 'Mara ya mwisho Ulandanishi umefanyika'
+ edit: 'Hariri'
+ delete: 'Futa'
+ save: 'Hifadhi'
+ field:
+ id: "Utambulisho"
+ email: "Barua Pepe"
+ amount_cents: "Kiasi (kwenye senti)"
+ rewards: "Tuzo"
+ declined_since: "Ombi Limekataliwa Tangia"
diff --git a/plugins/discourse-patreon/config/locales/client.te.yml b/plugins/discourse-patreon/config/locales/client.te.yml
new file mode 100644
index 00000000000..b5a37de5611
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.te.yml
@@ -0,0 +1,16 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+te:
+ js:
+ patreon:
+ group: 'సమూహం'
+ filter: 'జల్లెడ'
+ edit: 'సవరించు'
+ delete: 'తొలగించు'
+ save: 'భద్రపరచు'
+ field:
+ email: "ఈమెయిల్"
diff --git a/plugins/discourse-patreon/config/locales/client.th.yml b/plugins/discourse-patreon/config/locales/client.th.yml
new file mode 100644
index 00000000000..bb315c16744
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.th.yml
@@ -0,0 +1,15 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+th:
+ js:
+ patreon:
+ group: 'กลุ่ม'
+ edit: 'แก้ไข'
+ delete: 'ลบ'
+ save: 'บันทึก'
+ field:
+ email: "อีเมล"
diff --git a/plugins/discourse-patreon/config/locales/client.tr_TR.yml b/plugins/discourse-patreon/config/locales/client.tr_TR.yml
new file mode 100644
index 00000000000..e149b01bf2a
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.tr_TR.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+tr_TR:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Discourse Patreon"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: Patreon ile giriş yapın
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: 'Filtreler'
+ group: 'Grup'
+ rewards: 'Ödüller'
+ filter: 'Filtre'
+ help_text: 'Bir Discourse grubunu bir veya daha fazla Patreon ödül kademesiyle senkronize edebilirsiniz.'
+ last_synced: 'Son senkronize'
+ edit: 'Düzenle'
+ delete: 'Sil'
+ save: 'Kaydet'
+ update_data: 'Patreon Verilerini Güncelle ve Grupları Senkronize Et'
+ refresh_page: 'Patreon API''den yeni veriler indirildi. Lütfen sayfayı yenileyin.'
+ select_group: 'Grup seçin'
+ field:
+ id: "Kimlik"
+ email: "E-posta"
+ amount_cents: "Miktar (sent cinsinden)"
+ rewards: "Ödüller"
+ declined_since: "O Zamandan Bu Yana Bağış Azaldı"
+ more_details:
+ label: "Ödemeler ve Daha Fazla Ayrıntı"
+ help_text:
+ email_available: "Bu Patreon'un bağış geçmişini görmek için sayfanın sağ alt kısmına ulaşın."
+ email_not_available: "Bağış geçmişini görmek için Patreon üyesini seçin ve sayfanın sağ alt kısmına ulaşın."
+ donation_prompt:
+ body: |
+ <h1>Merhaba okuyucu!</h1>
+
+ <p>Web sitemizi beğendiniz mi? İyi bir amaca katkıda bulunmak ister misiniz?</p>
+
+ <p>
+ Web sitemizi yararlı buluyor ve oluşturduğumuz topluluktan hoşlanıyorsanız web sitemize bağışta bulunursanız çok seviniriz.
+ Bağışlar, hizmetlerimizin sorunsuz bir şekilde devam etmesini ve topluluğumuzun yıllarca faaliyette kalmasını sağlar.
+ Her miktar önemli ve iyi bir şekilde kullanılacak.
+ </p>
+
+ <p>Desteğiniz için teşekkür ederiz!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">Hami Olun</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.ug.yml b/plugins/discourse-patreon/config/locales/client.ug.yml
new file mode 100644
index 00000000000..f40e06d07b4
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.ug.yml
@@ -0,0 +1,16 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ug:
+ js:
+ patreon:
+ group: 'گۇرۇپپا'
+ filter: 'سۈزگۈچ'
+ edit: 'تەھرىر'
+ delete: 'ئۆچۈر'
+ save: 'ساقلا'
+ field:
+ email: "ئېلخەت"
diff --git a/plugins/discourse-patreon/config/locales/client.uk.yml b/plugins/discourse-patreon/config/locales/client.uk.yml
new file mode 100644
index 00000000000..d5b22ade92f
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.uk.yml
@@ -0,0 +1,16 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+uk:
+ js:
+ patreon:
+ group: 'Група'
+ filter: 'Filter'
+ edit: 'Редагувати'
+ delete: 'Видалити'
+ save: 'Зберегти'
+ field:
+ email: "Електронна пошта"
diff --git a/plugins/discourse-patreon/config/locales/client.ur.yml b/plugins/discourse-patreon/config/locales/client.ur.yml
new file mode 100644
index 00000000000..83a63df5de0
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.ur.yml
@@ -0,0 +1,36 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ur:
+ js:
+ login:
+ patreon:
+ name: پَیٹریئون
+ patreon:
+ title: 'پَیٹریئون'
+ header:
+ rules: 'فِلٹر'
+ group: 'گروپ'
+ rewards: 'انعامات'
+ filter: 'فِلٹر'
+ help_text: 'آپ کسی ڈسکورس گروپ کو ایک یا ایک سے زیادہ پَیٹریئون کے انعامات والے زمروں کے ساتھ مطابقت پذیر بنا سکتے ہیں۔'
+ last_synced: 'آخری دفعہ سینک کیا گیا'
+ edit: 'ترمیم کریں'
+ delete: 'حذف کریں'
+ save: 'محفوظ کریں'
+ update_data: 'پَیٹریئون ڈیٹا اَپ ڈیٹ کریں اور گروپس کو مطابقت پذیر بنائیں'
+ refresh_page: 'پَیٹریئون API سے نیا ڈیٹا ڈاؤن لوڈ کیا گیا ہے۔ براہ کرم صفحہ ریفریش کریں۔'
+ field:
+ id: "آئی ڈی"
+ email: "اِی میل"
+ amount_cents: "رقم (سینٹ میں)"
+ rewards: "انعامات"
+ declined_since: "سے پلِج انکار کیا گیا"
+ more_details:
+ label: "ادائیگیاں اور مزید تفصیلات"
+ help_text:
+ email_available: "اِس پَیٹریئون کی پلَیج ہِسٹری دیکھنے کیلئے صفحے کے نچلے دائیں حصہ تک پہنچیں۔"
+ email_not_available: "پلَیج ہِسٹری دیکھنے کیلئے پَیٹریئون رکن کو منتخب کریں اور صفحے کے نچلے دائیں حصہ تک پہنچیں۔"
diff --git a/plugins/discourse-patreon/config/locales/client.vi.yml b/plugins/discourse-patreon/config/locales/client.vi.yml
new file mode 100644
index 00000000000..91527b5cb89
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.vi.yml
@@ -0,0 +1,16 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+vi:
+ js:
+ patreon:
+ group: 'Nhóm'
+ filter: 'Lọc'
+ edit: 'Sửa'
+ delete: 'Xóa'
+ save: 'Lưu'
+ field:
+ email: "Email"
diff --git a/plugins/discourse-patreon/config/locales/client.zh_CN.yml b/plugins/discourse-patreon/config/locales/client.zh_CN.yml
new file mode 100644
index 00000000000..e919b9389b1
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.zh_CN.yml
@@ -0,0 +1,60 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+zh_CN:
+ admin_js:
+ admin:
+ site_settings:
+ categories:
+ discourse_patreon: "Discourse Patreon"
+ js:
+ login:
+ patreon:
+ name: Patreon
+ title: 使用 Patreon 登录
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: '筛选器'
+ group: '群组'
+ rewards: '奖励'
+ filter: '筛选器'
+ help_text: '您可以将 Discourse 群组与一个或多个 Patreon 奖励等级同步。'
+ last_synced: '最后同步'
+ edit: '编辑'
+ delete: '删除'
+ save: '保存'
+ update_data: '更新 Patreon 数据并同步群组'
+ refresh_page: '新数据已从 Patreon API 下载。请刷新页面。'
+ select_group: '选择一个群组'
+ field:
+ id: "ID"
+ email: "电子邮件"
+ amount_cents: "金额(以美分为单位)"
+ rewards: "奖励"
+ declined_since: "承诺拒绝自"
+ more_details:
+ label: "付款和更多详细信息"
+ help_text:
+ email_available: "在页面右下角查看 Patreon 的承诺历史。"
+ email_not_available: "选择 Patreon 成员并在页面右下角查看承诺历史。"
+ donation_prompt:
+ body: |
+ <h1>读者您好!</h1>
+
+ <p>您喜欢我们的网站吗?您是否愿意为公益事业做出贡献?</p>
+
+ <p>
+ 如果您认为我们的网站有所帮助并且喜欢我们创建的社区,我们将十分感激您能捐助我们的网站。
+ 捐助可以帮助我们的服务保持稳定运行,并确保我们的社区在未来几年内仍可正常运营。
+ 每一元的捐助都十分重要并会被妥当利用。
+ </p>
+
+ <p>感谢您的支持!<p>
+
+ <p>
+ <a class="btn btn-large btn-danger" href="%{campaignUrl}">成为赞助人</a>
+ </p>
diff --git a/plugins/discourse-patreon/config/locales/client.zh_TW.yml b/plugins/discourse-patreon/config/locales/client.zh_TW.yml
new file mode 100644
index 00000000000..49c6eac78c4
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/client.zh_TW.yml
@@ -0,0 +1,26 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+zh_TW:
+ js:
+ login:
+ patreon:
+ name: Patreon
+ patreon:
+ title: 'Patreon'
+ header:
+ rules: '過濾器'
+ group: '群組'
+ rewards: '獎勵'
+ filter: '過濾器'
+ help_text: '您可以將 Discourse 群組與一個或多個 Patreon 獎勵等級同步。'
+ edit: '編輯'
+ delete: '刪除'
+ save: '儲存'
+ update_data: '更新 Patreon 資料與同步群組'
+ field:
+ email: "電子信箱"
+ rewards: "獎勵"
diff --git a/plugins/discourse-patreon/config/locales/server.ar.yml b/plugins/discourse-patreon/config/locales/server.ar.yml
new file mode 100644
index 00000000000..01861761c25
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.ar.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ar:
+ site_settings:
+ patreon_enabled: 'تفعيل المكوِّن الإضافي discourse-patreon'
+ patreon_login_enabled: 'تفعيل تسجيل الدخول إلى Patreon بحساب تواصل اجتماعي'
+ patreon_client_id: 'مُعرِّف عميل Patreon الذي تم إنشاؤه'
+ patreon_client_secret: 'سر عمل Patreon الذي تم إنشاؤه'
+ patreon_webhook_secret: 'سر خطاف ويب Patreon الذي تم إنشاؤه'
+ patreon_creator_discourse_username: "اسم مستخدم حساب Discourse المستخدم لتسجيل الدخول من خلال أحد حسابات منشئي المحتوى على Patreon باستخدام 'تسجيل الدخول إلى Patreon بحساب تواصل اجتماعي'"
+ patreon_creator_access_token: "رمز وصول منشئ Patreon الذي تم إنشاؤه"
+ patreon_creator_refresh_token: "رمز تحديث منشئ Patreon الذي تم إنشاؤه"
+ patreon_declined_pledges_grace_period_days: "فترة السماح (بالأيام) قبل رفض التبرع تمامًا."
+ max_patreon_api_reqs_per_hr: "أقصى عدد لطلبات Patreon API في الساعة"
+ max_patreon_api_reqs_per_day: "أقصى عدد لطلبات Patreon API في اليوم"
+ patreon_verbose_log: 'تفعيل التسجيل المطوَّل لحمولة Patreon'
+ patreon_donation_prompt_enabled: "هل تريد تفعيل أمر التبرع؟"
+ patreon_donation_prompt_show_after_topics: "عرض أمر التبرع بعد N من الموضوعات"
+ patreon_donation_prompt_campaign_url: "عنوان URL لحملة أوامر التبرع"
+ errors:
+ patreon_creator_username_not_set: "أنت بحاجة إلى ضبط إعداد اسم مستخدم Discourse لمنشئي المحتوى على Patreon قبل تفعيل تسجيل الدخول باستخدام Patreon."
+ dashboard:
+ problem:
+ access_token_invalid: "قيم رمز الوصول والتحديث لمُنشئ Patreon غير صحيحة. يجب عليك نسخ ولصق الرموز الجديدة من <a href='https://www.patreon.com/platform/documentation/clients'>موقع Patreon على الويب</a> إلى <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>إعدادات الموقع</a>."
+ patreon:
+ error:
+ invalid_response: "استجابة غير صالحة من Patreon API"
diff --git a/plugins/discourse-patreon/config/locales/server.be.yml b/plugins/discourse-patreon/config/locales/server.be.yml
new file mode 100644
index 00000000000..2ea77a0d350
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.be.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+be:
diff --git a/plugins/discourse-patreon/config/locales/server.bg.yml b/plugins/discourse-patreon/config/locales/server.bg.yml
new file mode 100644
index 00000000000..52333529d3c
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.bg.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+bg:
diff --git a/plugins/discourse-patreon/config/locales/server.bs_BA.yml b/plugins/discourse-patreon/config/locales/server.bs_BA.yml
new file mode 100644
index 00000000000..828a7e65af8
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.bs_BA.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+bs_BA:
diff --git a/plugins/discourse-patreon/config/locales/server.ca.yml b/plugins/discourse-patreon/config/locales/server.ca.yml
new file mode 100644
index 00000000000..cfd3d54734c
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.ca.yml
@@ -0,0 +1,25 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ca:
+ site_settings:
+ patreon_enabled: 'Habilita el connector Discourse-Patreon'
+ patreon_login_enabled: 'Habilita la connexió social de Patreon'
+ patreon_client_id: 'ID generat de client Patreon '
+ patreon_client_secret: 'Secret de client generat de Patreon'
+ patreon_webhook_secret: 'Secret generat de Patreon Webhook'
+ patreon_creator_discourse_username: "Nom d'usuari del compte de Discourse que s'utilitza per a iniciar sessió mitjançant el compte de creador de Patreon fent servir 'Patreon Social Login'."
+ patreon_creator_access_token: "Testimoni d'accés generat de creador de Patreon"
+ patreon_creator_refresh_token: "Testimoni de refresc generat de creador de Patreon"
+ patreon_declined_pledges_grace_period_days: "Període de gràcia (en dies) abans que es denegui completament el compromís."
+ max_patreon_api_reqs_per_hr: "Nombre màxim de sol·licituds API de Patreon per hora"
+ max_patreon_api_reqs_per_day: "Nombre màxim de sol·licituds API de Patreon per dia"
+ patreon_verbose_log: 'habilita el registre detallat de la càrrega útil del Patreon'
+ patreon_donation_prompt_enabled: "Voleu activar la sol·licitud de donació?"
+ patreon_donation_prompt_show_after_topics: "Mostra el missatge de donació després de n temes"
+ patreon:
+ error:
+ invalid_response: "Resposta no vàlida de l'API de Patreon"
diff --git a/plugins/discourse-patreon/config/locales/server.cs.yml b/plugins/discourse-patreon/config/locales/server.cs.yml
new file mode 100644
index 00000000000..041b2f0bd05
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.cs.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+cs:
diff --git a/plugins/discourse-patreon/config/locales/server.da.yml b/plugins/discourse-patreon/config/locales/server.da.yml
new file mode 100644
index 00000000000..f39c727c594
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.da.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+da:
diff --git a/plugins/discourse-patreon/config/locales/server.de.yml b/plugins/discourse-patreon/config/locales/server.de.yml
new file mode 100644
index 00000000000..9488b0cc2f7
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.de.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+de:
+ site_settings:
+ patreon_enabled: 'Aktiviere das discourse-patreon-Plug-in'
+ patreon_login_enabled: 'Aktiviere das Patreon-Social-Log-in'
+ patreon_client_id: 'Generierte Patreon-Client-ID'
+ patreon_client_secret: 'Generiertes Patreon-Client-Geheimnis'
+ patreon_webhook_secret: 'Generiertes Patreon-Webhook-Geheimnis'
+ patreon_creator_discourse_username: "Benutzername des Discourse-Kontos, das für die Anmeldung über das Patreon-Ersteller-Konto mit „Patreon-Social-Log-in“ verwendet wird"
+ patreon_creator_access_token: "Generiertes Patreon-Ersteller-Zugriffstoken"
+ patreon_creator_refresh_token: "Generiertes Patreon-Ersteller-Aktualisierungstoken"
+ patreon_declined_pledges_grace_period_days: "Frist (in Tagen), bevor eine Spende vollständig abgelehnt wird."
+ max_patreon_api_reqs_per_hr: "Maximale Anzahl an Patreon-API-Anfragen pro Stunde"
+ max_patreon_api_reqs_per_day: "Maximale Anzahl von Patreon-API-Anfragen pro Tag"
+ patreon_verbose_log: 'aktiviert die ausführliche Protokollierung des Patreon-Payload'
+ patreon_donation_prompt_enabled: "Spendenaufforderung aktivieren?"
+ patreon_donation_prompt_show_after_topics: "Zeige Spendenaufforderung nach n Themen an"
+ patreon_donation_prompt_campaign_url: "URL der Spendenaufforderungskampagne"
+ errors:
+ patreon_creator_username_not_set: "Bevor du das Patreon-Log-in aktivieren kannst, musst du den Patreon-Ersteller-Discourse-Benutzernamen einstellen."
+ dashboard:
+ problem:
+ access_token_invalid: "Die Werte für die Zugangs- und Aktualisierungs-Token des Patreon-Erstellers sind falsch. Du musst neue Token von der <a href='https://www.patreon.com/platform/documentation/clients'>Patreon-Website</a> kopieren und in die <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>Website-Einstellungen</a> einfügen."
+ patreon:
+ error:
+ invalid_response: "Ungültige Antwort der Patreon-API"
diff --git a/plugins/discourse-patreon/config/locales/server.el.yml b/plugins/discourse-patreon/config/locales/server.el.yml
new file mode 100644
index 00000000000..d872d0ecc40
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.el.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+el:
diff --git a/plugins/discourse-patreon/config/locales/server.en.yml b/plugins/discourse-patreon/config/locales/server.en.yml
new file mode 100644
index 00000000000..b09dd60ad06
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.en.yml
@@ -0,0 +1,25 @@
+en:
+ site_settings:
+ patreon_enabled: 'Enable the discourse-patreon plugin'
+ patreon_login_enabled: 'Enable Patreon Social Login'
+ patreon_client_id: 'Generated Patreon Client ID'
+ patreon_client_secret: 'Generated Patreon Client Secret'
+ patreon_webhook_secret: 'Generated Patreon Webhook Secret'
+ patreon_creator_discourse_username: "Username of the Discourse account which is used to login through Patreon creator account using 'Patreon Social Login'"
+ patreon_creator_access_token: "Generated Patreon Creator's Access Token"
+ patreon_creator_refresh_token: "Generated Patreon Creator's Refesh Token"
+ patreon_declined_pledges_grace_period_days: "Grace period (in days) before a pledge is declined completely."
+ max_patreon_api_reqs_per_hr: "Maximum number of Patreon API requests per hour"
+ max_patreon_api_reqs_per_day: "Maximum number of Patreon API requests per day"
+ patreon_verbose_log: 'enable verbose logging of patreon payload'
+ patreon_donation_prompt_enabled: "Enable donation prompt?"
+ patreon_donation_prompt_show_after_topics: "Show donation prompt after n topics"
+ patreon_donation_prompt_campaign_url: "Donation prompt campaign URL"
+ errors:
+ patreon_creator_username_not_set: "You need to set the Patreon Creator Discourse Username setting before enabling Patreon Login."
+ dashboard:
+ problem:
+ access_token_invalid: "Patreon Creator's access and refresh token values are incorrect. You must copy-paste new tokens from <a href='https://www.patreon.com/platform/documentation/clients'>Patreon website</a> to <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>site settings</a>."
+ patreon:
+ error:
+ invalid_response: "Invalid response from Patreon API"
diff --git a/plugins/discourse-patreon/config/locales/server.en_GB.yml b/plugins/discourse-patreon/config/locales/server.en_GB.yml
new file mode 100644
index 00000000000..2d4fa180ec7
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.en_GB.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+en_GB:
diff --git a/plugins/discourse-patreon/config/locales/server.es.yml b/plugins/discourse-patreon/config/locales/server.es.yml
new file mode 100644
index 00000000000..9ad2bfb34bd
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.es.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+es:
+ site_settings:
+ patreon_enabled: 'Habilitar el complemento discourse-patreon'
+ patreon_login_enabled: 'Habilitar el inicio de sesión a través de Patreon'
+ patreon_client_id: 'ID de cliente de Patreon generada'
+ patreon_client_secret: 'Secreto de cliente de Patreon generado'
+ patreon_webhook_secret: 'Secreto de webhook de Patreon generado'
+ patreon_creator_discourse_username: "Nombre de usuario de la cuenta de Discourse que se usa para iniciar sesión mediante la cuenta de creador de Patreon usando el «inicio de sesión a través de Patreon»"
+ patreon_creator_access_token: "Token de acceso de creador de Patreon generado"
+ patreon_creator_refresh_token: "Token de actualización de creador de Patreon generado"
+ patreon_declined_pledges_grace_period_days: "Período de gracia (en días) antes de que una promesa se rechace por completo."
+ max_patreon_api_reqs_per_hr: "Número máximo de solicitudes del API de Patreon por hora"
+ max_patreon_api_reqs_per_day: "Número máximo de solicitudes del API de Patreon por día"
+ patreon_verbose_log: 'habilitar el registro detallado de la carga útil de Patreon'
+ patreon_donation_prompt_enabled: "¿Activar el aviso de donación?"
+ patreon_donation_prompt_show_after_topics: "Mostrar aviso de donación después de n temas"
+ patreon_donation_prompt_campaign_url: "URL de la campaña de donación"
+ errors:
+ patreon_creator_username_not_set: "Tienes que establecer la configuración del Nombre de usuario de Discourse para Patreon Creator antes de activar el inicio de sesión de Patreon."
+ dashboard:
+ problem:
+ access_token_invalid: "Los valores de los tokens de acceso y actualización de Patreon Creator son incorrectos. Debes copiar y pegar los nuevos tokens del <a href='https://www.patreon.com/platform/documentation/clients'>sitio web de Patreon</a> a los <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>ajustes del sitio</a>."
+ patreon:
+ error:
+ invalid_response: "Respuesta no válida de la API de Patreon"
diff --git a/plugins/discourse-patreon/config/locales/server.et.yml b/plugins/discourse-patreon/config/locales/server.et.yml
new file mode 100644
index 00000000000..0ea0b6d554b
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.et.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+et:
diff --git a/plugins/discourse-patreon/config/locales/server.fa_IR.yml b/plugins/discourse-patreon/config/locales/server.fa_IR.yml
new file mode 100644
index 00000000000..56512089fb5
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.fa_IR.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fa_IR:
diff --git a/plugins/discourse-patreon/config/locales/server.fi.yml b/plugins/discourse-patreon/config/locales/server.fi.yml
new file mode 100644
index 00000000000..53632a0c876
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.fi.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fi:
+ site_settings:
+ patreon_enabled: 'Ota discourse-patreon-lisäosa käyttöön'
+ patreon_login_enabled: 'Ota käyttöön yhteisökirjautuminen Patreonilla'
+ patreon_client_id: 'Luotu Patreonin asiakastunnus (client ID)'
+ patreon_client_secret: 'Luotu Patreonin asiakkaan salatunnus (client secret)'
+ patreon_webhook_secret: 'Luotu Patreonin webhook-salausavain (webhook secret)'
+ patreon_creator_discourse_username: "Sen Discourse-tilin käyttäjätunnus, jota käytetään kirjauduttaessa Patreon-tuottajatilin (engl. creator account) kautta Patreonin yhteisökirjautumisen kautta"
+ patreon_creator_access_token: "Luotu Patreonin tuottajan tunnistusväline (creator's access token)"
+ patreon_creator_refresh_token: "Luotu Patreonin tuottajan päivitysväline (creator's refresh token)"
+ patreon_declined_pledges_grace_period_days: "Varoaika (päivinä), kunnes lahjoituslupaus hylätään lopullisesti."
+ max_patreon_api_reqs_per_hr: "Patreon API-pyyntöjen enimmäismäärä per tunti"
+ max_patreon_api_reqs_per_day: "Patreon API-pyyntöjen päivittäinen enimmäismäärä"
+ patreon_verbose_log: 'salli patreon-tietosisällön monikirjaus'
+ patreon_donation_prompt_enabled: "Otetaanko lahjoituskehotus käyttöön?"
+ patreon_donation_prompt_show_after_topics: "Näytä lahjoituskehotus n ketjun jälkeen"
+ patreon_donation_prompt_campaign_url: "Lahjoituskehotuskampanjan URL"
+ errors:
+ patreon_creator_username_not_set: "Sinun täytyy määrittää Patreon Creator Discourse -käyttäjätunnusasetus ennen kuin otat Patreon-kirjautumisen käyttöön."
+ dashboard:
+ problem:
+ access_token_invalid: "Patreonin tuottajan tunnistus- ja päivitysvälineiden arvot ovat virheellisiä. Sinun täytyy kopioida ja liittää uudet välineet <a href='https://www.patreon.com/platform/documentation/clients'>Patreonin verkkosivustolta</a> <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>sivuston asetuksiin</a>."
+ patreon:
+ error:
+ invalid_response: "Virheellinen vastaus Patreonin APIsta"
diff --git a/plugins/discourse-patreon/config/locales/server.fr.yml b/plugins/discourse-patreon/config/locales/server.fr.yml
new file mode 100644
index 00000000000..3b5ce1a885f
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.fr.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fr:
+ site_settings:
+ patreon_enabled: 'Activer l''extension discourse-patreon'
+ patreon_login_enabled: 'Activer la connexion de réseau social Patreon'
+ patreon_client_id: 'ID de client Patreon généré'
+ patreon_client_secret: 'Secret du client Patreon généré'
+ patreon_webhook_secret: 'Secret du Webhook Patreon généré'
+ patreon_creator_discourse_username: "Nom d'utilisateur du compte Discourse qui est utilisé pour se connecter via le compte de créateur Patreon à l'aide de « Connexion de réseau social Patreon »"
+ patreon_creator_access_token: "Jeton d'accès de créateur Patreon généré"
+ patreon_creator_refresh_token: "Jeton d'actualisation de créateur Patreon généré"
+ patreon_declined_pledges_grace_period_days: "Période de grâce (en jours) avant que la promesse de don soit définitivement refusée."
+ max_patreon_api_reqs_per_hr: "Nombre maximal de requêtes d'API Patreon par heure"
+ max_patreon_api_reqs_per_day: "Nombre maximal de requêtes d'API Patreon par jour"
+ patreon_verbose_log: 'activer la journalisation détaillée des données Patreon'
+ patreon_donation_prompt_enabled: "Activer l'invite de donation ?"
+ patreon_donation_prompt_show_after_topics: "Afficher l'invite de donation après n sujets"
+ patreon_donation_prompt_campaign_url: "URL de la campagne d'incitation aux donations"
+ errors:
+ patreon_creator_username_not_set: "Vous devez définir le paramètre Patreon Creator Discourse Username avant d'activer la connexion Patreon."
+ dashboard:
+ problem:
+ access_token_invalid: "Les valeurs des jetons d'accès et d'actualisation du créateur Patreon sont incorrectes. Vous devez copier-coller les nouveaux jetons à partir du <a href='https://www.patreon.com/platform/documentation/clients'>site Web de Patreon</a> vers <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>les paramètres du site</a>."
+ patreon:
+ error:
+ invalid_response: "Réponse invalide de l'API Patreon"
diff --git a/plugins/discourse-patreon/config/locales/server.gl.yml b/plugins/discourse-patreon/config/locales/server.gl.yml
new file mode 100644
index 00000000000..fb911ce1635
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.gl.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+gl:
diff --git a/plugins/discourse-patreon/config/locales/server.he.yml b/plugins/discourse-patreon/config/locales/server.he.yml
new file mode 100644
index 00000000000..0f7061baf82
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.he.yml
@@ -0,0 +1,28 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+he:
+ site_settings:
+ patreon_enabled: 'הפעלת התוסף discourse-patreon'
+ patreon_login_enabled: 'הפעלת כניסה ל־Patreon דרך רשת חברתית'
+ patreon_client_id: 'נוצר מזהה לקוח Patreon'
+ patreon_client_secret: 'נוצר סוד לקוח Patreon'
+ patreon_webhook_secret: 'נוצרה התליית סוד של Patreon'
+ patreon_creator_discourse_username: "שם המשתמש של חשבון ה־Discourse שמשמש לכניסה באמצעות חשבון יוצר ב־Patreon עם ‚כניסה ל־Patreon דרך רשת חברתית’"
+ patreon_creator_access_token: "נוצר אסימון גישה ליוצר ב־Patreon"
+ patreon_creator_refresh_token: "נוצר אסימון רענון ליוצר ב־Patreon"
+ patreon_declined_pledges_grace_period_days: "תקופת חסד (בימים) לפני שההבטחה תידחה לחלוטין."
+ max_patreon_api_reqs_per_hr: "מספר הבקשות המרבי ל־API של Patreon בשעה"
+ max_patreon_api_reqs_per_day: "מספר הבקשות המרבי ל־API של Patreon ביום"
+ patreon_verbose_log: 'הפעלת תיעוד מפורט ביומן של התעבורה מול patreon'
+ patreon_donation_prompt_enabled: "להפעיל הודעת בקשת תרומה?"
+ patreon_donation_prompt_show_after_topics: "הצגת הודעת בקשה תרומה לאחר n נושאים"
+ patreon_donation_prompt_campaign_url: "כתובת בקשב לתרומה במסע פרסום"
+ errors:
+ patreon_creator_username_not_set: "עליך להגדיר את שם המשתמש ב־Discourse ליוצר Patreon בטרם הפעלת כניסה עם Patreon."
+ patreon:
+ error:
+ invalid_response: "תגובה שגויה מה־API של Patreon"
diff --git a/plugins/discourse-patreon/config/locales/server.hr.yml b/plugins/discourse-patreon/config/locales/server.hr.yml
new file mode 100644
index 00000000000..19e2ee6ff0d
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.hr.yml
@@ -0,0 +1,23 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hr:
+ site_settings:
+ patreon_enabled: 'Omogućite discourse-pateron dodatak'
+ patreon_login_enabled: 'Omogućite Pateron Social Login'
+ patreon_client_id: 'Generirani Pateron Client ID'
+ patreon_client_secret: 'Generirani Patreon Client Secret'
+ patreon_webhook_secret: 'Generirani Patreon Webhook Secret'
+ patreon_creator_discourse_username: "Korisničko ime Discourse računa kojim se prijavljuje na Pateron creator račun koristeći 'Patreon Social Login'"
+ patreon_creator_access_token: "Generirani Patreon Creator's Access Token"
+ patreon_creator_refresh_token: "Generirani Pateron Creator's Refresh Token"
+ patreon_declined_pledges_grace_period_days: "Razdoblje počeka (u danima) prije potpunog odbijanja zaloga."
+ max_patreon_api_reqs_per_hr: "Maksimalni broj Patreon API zahtjeva u jednom satu"
+ max_patreon_api_reqs_per_day: "Maksimalni broj Pateron API zahtjeva u jednom danu"
+ patreon_verbose_log: 'omogućite opširno logiranje patreon podataka'
+ patreon:
+ error:
+ invalid_response: "Nevažeći odgovor Patreon API-ja"
diff --git a/plugins/discourse-patreon/config/locales/server.hu.yml b/plugins/discourse-patreon/config/locales/server.hu.yml
new file mode 100644
index 00000000000..76b6e9d8bcb
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.hu.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hu:
diff --git a/plugins/discourse-patreon/config/locales/server.hy.yml b/plugins/discourse-patreon/config/locales/server.hy.yml
new file mode 100644
index 00000000000..03c065987c4
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.hy.yml
@@ -0,0 +1,23 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hy:
+ site_settings:
+ patreon_enabled: 'Միացնել discourse-patreon պլագինը'
+ patreon_login_enabled: 'Միացնել Patreon Սոցիալակա կայքով Մուտքը'
+ patreon_client_id: 'Գեներացված Patreon Հաճախորդի ID'
+ patreon_client_secret: 'Գեներացված Patreon Հաճախորդի Գաղտնիք'
+ patreon_webhook_secret: 'Գեներացված Patreon Webhook Գաղտնիք'
+ patreon_creator_discourse_username: "Discourse հաշվի օգտանուն, որը օգտագործվում է Patreon ստեղծողի հաշվի միջոցով մուտք գործելու ժամանակ՝ օգտագործելով 'Patreon Սոցիալական կայքով Մուտքը'"
+ patreon_creator_access_token: "Գեներացված Patreon Ստեղծողի հասանելիության տոկեն"
+ patreon_creator_refresh_token: "Գեներացված Patreon Creator's Refesh TokenՍտեղծողի Թարմացման Տոկեն"
+ patreon_declined_pledges_grace_period_days: "Արտոնյալ ժամկետը (օրերով) , որից հետո երաշխիքը ամբողջությամբ մերժվում է:"
+ max_patreon_api_reqs_per_hr: "Patreon API հարցումների առավելագույն քանակը մեկ ժամում"
+ max_patreon_api_reqs_per_day: "Patreon API հարցումների առավելագույն քանակը մեկ օրում"
+ patreon_verbose_log: 'միացնել patreon տվյալների ուղարկման բառային մուտքագրումը'
+ patreon:
+ error:
+ invalid_response: "Անվավեր արձագանք Patreon API -ից"
diff --git a/plugins/discourse-patreon/config/locales/server.id.yml b/plugins/discourse-patreon/config/locales/server.id.yml
new file mode 100644
index 00000000000..596e36b2e13
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.id.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+id:
diff --git a/plugins/discourse-patreon/config/locales/server.it.yml b/plugins/discourse-patreon/config/locales/server.it.yml
new file mode 100644
index 00000000000..d3f3059c474
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.it.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+it:
+ site_settings:
+ patreon_enabled: 'Abilita il plugin discourse-patreon'
+ patreon_login_enabled: 'Abilita l''accesso social di Patreon'
+ patreon_client_id: 'ID client di Patreon generato'
+ patreon_client_secret: 'Segreto client di Patreon generato'
+ patreon_webhook_secret: 'Segreto webhook di Patreon generato'
+ patreon_creator_discourse_username: "Nome utente dell'account Discourse che viene utilizzato per accedere tramite l'account di Patreon creator utilizzando l'\"Accesso Social di Patreon\""
+ patreon_creator_access_token: "Token di accesso a Patreon Creator generato"
+ patreon_creator_refresh_token: "Token di aggiornamento per Patreon Creator generato"
+ patreon_declined_pledges_grace_period_days: "Il periodo di tolleranza (in giorni) prima che una promessa di donazione sia completamente rifiutata."
+ max_patreon_api_reqs_per_hr: "Numero massimo di richieste API Patreon all'ora"
+ max_patreon_api_reqs_per_day: "Numero massimo di richieste API Patreon al giorno"
+ patreon_verbose_log: 'abilita la diagnostica dettagliata del payload di patreon'
+ patreon_donation_prompt_enabled: "Abilitare la richiesta di donazione?"
+ patreon_donation_prompt_show_after_topics: "Mostra la richiesta di donazione dopo n argomenti"
+ patreon_donation_prompt_campaign_url: "URL della campagna per la richiesta di donazioni"
+ errors:
+ patreon_creator_username_not_set: "Devi impostare il nome utente di Patreon Creator Discourse prima di abilitare l'accesso a Patreon."
+ dashboard:
+ problem:
+ access_token_invalid: "I valori dei token di accesso e aggiornamento di Patreon Creator sono errati. Devi copiare e incollare i nuovi token dal <a href='https://www.patreon.com/platform/documentation/clients'>sito web Patreon</a> alle <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>impostazioni del sito</a>."
+ patreon:
+ error:
+ invalid_response: "Risposta non valida dall'API Patreon"
diff --git a/plugins/discourse-patreon/config/locales/server.ja.yml b/plugins/discourse-patreon/config/locales/server.ja.yml
new file mode 100644
index 00000000000..13b46ab99d4
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.ja.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ja:
+ site_settings:
+ patreon_enabled: 'discourse-patreon プラグインを有効にする'
+ patreon_login_enabled: 'Patreon ソーシャルログインを有効にする'
+ patreon_client_id: '生成された Patreon クライアント ID'
+ patreon_client_secret: '生成された Patreon クライアントシークレット'
+ patreon_webhook_secret: '生成された Patreon Webhook シークレット'
+ patreon_creator_discourse_username: "「Patreon ソーシャルログイン」でPatreon クリエーターアカウントを通じてログインするために使用する Discourse アカウントのユーザー名"
+ patreon_creator_access_token: "生成された Patreon クリエーターのアクセストークン"
+ patreon_creator_refresh_token: "生成された Patreon クリエーターのリフレッシュトークン"
+ patreon_declined_pledges_grace_period_days: "誓約が完全に拒否されるまでの猶予期間(日数)。"
+ max_patreon_api_reqs_per_hr: "1 時間当たりの Patreon API の最大リクエスト数"
+ max_patreon_api_reqs_per_day: "1 日当たりの Patreon API リクエストの最大数"
+ patreon_verbose_log: 'Patreon ペイロードの詳細なロギングを有効にする'
+ patreon_donation_prompt_enabled: "寄付プロンプトを有効にしますか?"
+ patreon_donation_prompt_show_after_topics: "トピック n 件ごとに寄付プロンプトを表示する"
+ patreon_donation_prompt_campaign_url: "寄付プロンプトのキャンペーン URL"
+ errors:
+ patreon_creator_username_not_set: "Patreon ログインを有効にする前に、Patreon クリエーターの Discourse ユーザー名設定を設定する必要があります。"
+ dashboard:
+ problem:
+ access_token_invalid: "Patreon Creator のアクセストークンとリフレッシュトークンの値が間違っています。<a href='https://www.patreon.com/platform/documentation/clients'>Patreon ウェブサイト</a>から新しいトークンをコピーして<a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>サイト設定</a>に貼り付ける必要があります。"
+ patreon:
+ error:
+ invalid_response: "Patreon API からの無効な応答"
diff --git a/plugins/discourse-patreon/config/locales/server.ko.yml b/plugins/discourse-patreon/config/locales/server.ko.yml
new file mode 100644
index 00000000000..3759c60ca9a
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.ko.yml
@@ -0,0 +1,26 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ko:
+ site_settings:
+ patreon_enabled: '담화 패턴 플러그인 활성화'
+ patreon_login_enabled: 'Patreon 소셜 로그인 활성화'
+ patreon_client_id: '생성 된 Patreon 클라이언트 ID'
+ patreon_client_secret: '생성 된 Patreon 클라이언트 시크릿'
+ patreon_webhook_secret: '생성 된 Patreon Webhook Secret'
+ patreon_creator_discourse_username: "&#39;Patreon Social Login&#39;을 사용하여 Patreon 제작자 계정을 통해 로그인하는 데 사용되는 담화 계정의 사용자 이름"
+ patreon_creator_access_token: "Patreon Creator의 액세스 토큰 생성"
+ patreon_creator_refresh_token: "생성 된 Patreon Creator의 Refesh Token"
+ patreon_declined_pledges_grace_period_days: "서약이 완전히 거절되기 전의 유예 기간 (일)."
+ max_patreon_api_reqs_per_hr: "시간당 최대 Patreon API 요청 수"
+ max_patreon_api_reqs_per_day: "하루 최대 Patreon API 요청 수"
+ patreon_verbose_log: 'patreon 페이로드에 대한 자세한 로깅 사용'
+ patreon_donation_prompt_enabled: "기부 프롬프트를 사용 하시겠습니까?"
+ patreon_donation_prompt_show_after_topics: "n 개의 주제 다음에 기부 프롬프트 표시"
+ patreon_donation_prompt_campaign_url: "기부 프롬프트 캠페인 URL"
+ patreon:
+ error:
+ invalid_response: "Patreon API의 잘못된 응답"
diff --git a/plugins/discourse-patreon/config/locales/server.lt.yml b/plugins/discourse-patreon/config/locales/server.lt.yml
new file mode 100644
index 00000000000..291cc2b6713
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.lt.yml
@@ -0,0 +1,9 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+lt:
+ site_settings:
+ patreon_login_enabled: 'Įgalinti Patreon prisijungimą'
diff --git a/plugins/discourse-patreon/config/locales/server.lv.yml b/plugins/discourse-patreon/config/locales/server.lv.yml
new file mode 100644
index 00000000000..59e0ef6f4ed
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.lv.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+lv:
diff --git a/plugins/discourse-patreon/config/locales/server.nb_NO.yml b/plugins/discourse-patreon/config/locales/server.nb_NO.yml
new file mode 100644
index 00000000000..2e2224d1472
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.nb_NO.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+nb_NO:
diff --git a/plugins/discourse-patreon/config/locales/server.nl.yml b/plugins/discourse-patreon/config/locales/server.nl.yml
new file mode 100644
index 00000000000..7580991208a
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.nl.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+nl:
+ site_settings:
+ patreon_enabled: 'Discourse-Patreon-plug-in inschakelen'
+ patreon_login_enabled: 'Sociale aanmelding voor Patreon inschakelen'
+ patreon_client_id: 'Gegenereerde Patreon-client-ID'
+ patreon_client_secret: 'Gegenereerd Patreon-clientgeheim'
+ patreon_webhook_secret: 'Gegenereerd Patreon-webhookgeheim'
+ patreon_creator_discourse_username: "Gebruikersnaam van het Discourse-account dat wordt gebruikt voor aanmelding via een Patreon-makersaccount met behulp van 'Sociale aanmelding voor Patreon'"
+ patreon_creator_access_token: "Gegenereerd toegangstoken van Patreon-maker"
+ patreon_creator_refresh_token: "Gegenereerd vernieuwingstoken van Patreon-maker"
+ patreon_declined_pledges_grace_period_days: "Respijtperiode (in dagen) voordat een donatie volledig wordt geweigerd."
+ max_patreon_api_reqs_per_hr: "Maximaal aantal Patreon-API-verzoeken per uur"
+ max_patreon_api_reqs_per_day: "Maximaal aantal Patreon-API-verzoeken per dag"
+ patreon_verbose_log: 'Uitgebreide logging van Patreon-payload inschakelen'
+ patreon_donation_prompt_enabled: "Donatievraag inschakelen?"
+ patreon_donation_prompt_show_after_topics: "Donatievraag weergeven na n topics"
+ patreon_donation_prompt_campaign_url: "Campagne-URL voor donatievraag"
+ errors:
+ patreon_creator_username_not_set: "Je moet de instelling Discourse-gebruikersnaam Patreon-maker instellen voordat je Patreon-aanmelding inschakelt."
+ dashboard:
+ problem:
+ access_token_invalid: "Het toegangs- en het verversingstoken van Patreon Creator zijn onjuist. Je moet nieuwe tokens kopiëren en plakken vanaf de <a href='https://www.patreon.com/platform/documentation/clients'>Patreon-website</a> naar de <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>site-instellingen</a>."
+ patreon:
+ error:
+ invalid_response: "Ongeldig antwoord van Patreon-API"
diff --git a/plugins/discourse-patreon/config/locales/server.pl_PL.yml b/plugins/discourse-patreon/config/locales/server.pl_PL.yml
new file mode 100644
index 00000000000..cfbadc74c4f
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.pl_PL.yml
@@ -0,0 +1,26 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pl_PL:
+ site_settings:
+ patreon_enabled: 'Włącz wtyczkę discourse‐patreon'
+ patreon_login_enabled: 'Włącz logowanie za pomocą Patreona'
+ patreon_client_id: 'Wygenerowane Client ID Patreona'
+ patreon_client_secret: 'Wygenerowany Patreon Client Secret'
+ patreon_webhook_secret: 'Wygenerowany Patreon Webhook Secret'
+ patreon_creator_discourse_username: "Nazwa konta do zalogowania przez konto kreatora Patreon przy użyciu \"logowania za pomocą Patreona\""
+ patreon_creator_access_token: "Wygenerowany klucz dostępu kreatora Patreon"
+ patreon_creator_refresh_token: "Wygenerowany token odświeżania kreatora Patreon"
+ patreon_declined_pledges_grace_period_days: "Okres karencji (w dniach) przed całkowitym odrzuceniem wpłaty."
+ max_patreon_api_reqs_per_hr: "Maksymalna liczba zapytań o API Patreona na godzinę"
+ max_patreon_api_reqs_per_day: "Maksymalna liczba zapytań o API Patreona na dzień"
+ patreon_verbose_log: 'aktywuj pełne logowanie do ładunku Patreona'
+ patreon_donation_prompt_enabled: "Włączyć zachętę do dotacji?"
+ patreon_donation_prompt_show_after_topics: "Pokaż zachętę do dotacji po n tematach."
+ patreon_donation_prompt_campaign_url: "URL kampanii zachęcającej do dotacji"
+ patreon:
+ error:
+ invalid_response: "Nieprawidłowa odpowiedź z API Patreona"
diff --git a/plugins/discourse-patreon/config/locales/server.pt.yml b/plugins/discourse-patreon/config/locales/server.pt.yml
new file mode 100644
index 00000000000..e21aba75b23
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.pt.yml
@@ -0,0 +1,15 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pt:
+ site_settings:
+ patreon_enabled: 'Ativar o ''''plug-in'''' de discourse-patreon'
+ patreon_login_enabled: 'Ativar Credencial Social de Patreon'
+ patreon_client_id: 'Gerada Id. do Cliente Patreon'
+ patreon_client_secret: 'Gerado Segredo de Cliente Patreon'
+ patreon_webhook_secret: 'Gerado Segredo de Patreon Webhook Patreon'
+ patreon_creator_discourse_username: "Nome de utilizador da conta Discourse que é utilizada para iniciar a sessão na conta do criador Patreon utilizando a 'Credencial Social do Patreon'"
+ patreon_creator_access_token: "Gerado Código de Acesso do Criador Patreon"
diff --git a/plugins/discourse-patreon/config/locales/server.pt_BR.yml b/plugins/discourse-patreon/config/locales/server.pt_BR.yml
new file mode 100644
index 00000000000..244c49dbca1
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.pt_BR.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pt_BR:
+ site_settings:
+ patreon_enabled: 'Ativar o plugin discourse-patreon'
+ patreon_login_enabled: 'Ativar Login Social do Patreon'
+ patreon_client_id: 'ID do cliente Patreon gerado'
+ patreon_client_secret: 'Segredo do cliente Patreon gerado'
+ patreon_webhook_secret: 'Segredo do Webhook do Patreon gerado'
+ patreon_creator_discourse_username: "Nome do(a) usuário(a) da conta do Discourse que é usado para entrar pela conta do(a) criador(a) do Patreon com o \"Login Social do Patreon\""
+ patreon_creator_access_token: "Token de acesso do criador do Patreon gerado"
+ patreon_creator_refresh_token: "Token de atualização do(a) criador(a) do Patreon gerado"
+ patreon_declined_pledges_grace_period_days: "Período de carência (em dias) antes que um compromisso seja recusado completamente."
+ max_patreon_api_reqs_per_hr: "Número máximo de solicitações da API do Patreon por hora"
+ max_patreon_api_reqs_per_day: "Número máximo de solicitações da API do Patreon por dia"
+ patreon_verbose_log: 'ativar registro prolixo do conteúdo do Patreon'
+ patreon_donation_prompt_enabled: "Ativar solicitação de doação?"
+ patreon_donation_prompt_show_after_topics: "Mostrar solicitação de doação após n tópicos"
+ patreon_donation_prompt_campaign_url: "URL da campanha de solicitação de doação"
+ errors:
+ patreon_creator_username_not_set: "Você precisa definir a configuração do nome do(a) usuário(a) do Discourse do(a) criador(a) do Patreon antes de ativar o login do Patreon."
+ dashboard:
+ problem:
+ access_token_invalid: "Os valores dos tokens de atualização e acesso do Patreon Creator estão incorretos. É preciso copiar e colar os novos tokens de <a href='https://www.patreon.com/platform/documentation/clients'>Patreon website</a> para as <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>configurações do site</a>."
+ patreon:
+ error:
+ invalid_response: "Resposta inválida da API do Patreon"
diff --git a/plugins/discourse-patreon/config/locales/server.ro.yml b/plugins/discourse-patreon/config/locales/server.ro.yml
new file mode 100644
index 00000000000..fb9f7363324
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.ro.yml
@@ -0,0 +1,15 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ro:
+ site_settings:
+ patreon_enabled: 'Activează modulul discourse-patreon'
+ patreon_login_enabled: 'Activează conectarea socială Patreon'
+ patreon_client_id: 'ID client Patreon generat'
+ patreon_client_secret: 'Secret client Patreon generat'
+ dashboard:
+ problem:
+ access_token_invalid: "Valorile jetoanelor de acces și de reîmprospătare ale Creatorului Patreon sunt incorecte. Trebuie să copiezi și să lipești noile jetoane de pe <a href='https://www.patreon.com/platform/documentation/clients'>site-ul Patreon</a> în <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>setările site-ului</a>."
diff --git a/plugins/discourse-patreon/config/locales/server.ru.yml b/plugins/discourse-patreon/config/locales/server.ru.yml
new file mode 100644
index 00000000000..fea4dc9185e
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.ru.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ru:
+ site_settings:
+ patreon_enabled: 'Включить плагин discourse-patreon'
+ patreon_login_enabled: 'Включить Patreon Social Login'
+ patreon_client_id: 'Сгенерированный Patreon Client ID'
+ patreon_client_secret: 'Сгенерированный Patreon Client Secret'
+ patreon_webhook_secret: 'Сгенерированный Patreon Webhook Secret'
+ patreon_creator_discourse_username: "Имя пользователя Discourse, которое используется для входа через учётную запись Patreon с помощью 'Patreon Social Login'"
+ patreon_creator_access_token: "Сгенерированный access-токен от Patreon"
+ patreon_creator_refresh_token: "Сгенерированный refesh-токен от Patreon"
+ patreon_declined_pledges_grace_period_days: "Период ожидания (в днях) до полного отказа от подписки."
+ max_patreon_api_reqs_per_hr: "Максимальное количество запросов Patreon API в час"
+ max_patreon_api_reqs_per_day: "Максимальное количество запросов Patreon API в день"
+ patreon_verbose_log: 'Добавлять в журнал подробную информацию при работе с Patreon'
+ patreon_donation_prompt_enabled: "Включить запрос на пожертвование?"
+ patreon_donation_prompt_show_after_topics: "Показывать приглашение к пожертвованию после указанного здесь количества тем"
+ patreon_donation_prompt_campaign_url: "URL рекламной кампании для пожертвований"
+ errors:
+ patreon_creator_username_not_set: "Перед включением входа через Patreon необходимо установить настройку имени пользователя в Patreon Creator Discourse."
+ dashboard:
+ problem:
+ access_token_invalid: "Значения токенов доступа и обновления Patreon Creator неверны. Вам нужно скопировать и вставить новые токены с <a href='https://www.patreon.com/platform/documentation/clients'>сайта Patreon</a> в <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>, настройки сайта</a>."
+ patreon:
+ error:
+ invalid_response: "Неверный ответ от Patreon API"
diff --git a/plugins/discourse-patreon/config/locales/server.sk.yml b/plugins/discourse-patreon/config/locales/server.sk.yml
new file mode 100644
index 00000000000..6f815624081
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.sk.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sk:
diff --git a/plugins/discourse-patreon/config/locales/server.sl.yml b/plugins/discourse-patreon/config/locales/server.sl.yml
new file mode 100644
index 00000000000..696929c8e29
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.sl.yml
@@ -0,0 +1,9 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sl:
+ site_settings:
+ patreon_enabled: 'Vključi discourse-patreon vtičnik'
diff --git a/plugins/discourse-patreon/config/locales/server.sq.yml b/plugins/discourse-patreon/config/locales/server.sq.yml
new file mode 100644
index 00000000000..7f051b7a7cf
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.sq.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sq:
diff --git a/plugins/discourse-patreon/config/locales/server.sr.yml b/plugins/discourse-patreon/config/locales/server.sr.yml
new file mode 100644
index 00000000000..88d63d6ae1a
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.sr.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sr:
diff --git a/plugins/discourse-patreon/config/locales/server.sv.yml b/plugins/discourse-patreon/config/locales/server.sv.yml
new file mode 100644
index 00000000000..dc7fe4d34c5
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.sv.yml
@@ -0,0 +1,28 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sv:
+ site_settings:
+ patreon_enabled: 'Aktivera discourse-patreon-tillägget'
+ patreon_login_enabled: 'Aktivera Patreon Social Login'
+ patreon_client_id: 'Genererade Patreon-klient-ID'
+ patreon_client_secret: 'Genererade Patreon-klienthemlighet'
+ patreon_webhook_secret: 'Genererade Patreon Webhook-hemlighet'
+ patreon_creator_discourse_username: "Användarnamn på det Discourse-konto som används för att logga in via Patreon-skaparkonto med 'Patreon Social Login'"
+ patreon_creator_access_token: "Genererade Patreon Creator-åtkomstbevis"
+ patreon_creator_refresh_token: "Genererade Patreon Creator-uppdateringsbevis"
+ patreon_declined_pledges_grace_period_days: "Nådefrist (i dagar) innan en donation nekas helt."
+ max_patreon_api_reqs_per_hr: "Maximalt antal Patreon API-förfrågningar per timme"
+ max_patreon_api_reqs_per_day: "Maximalt antal Patreon API-förfrågningar per dag"
+ patreon_verbose_log: 'aktivera utförlig loggning av Patreon-nyttolast'
+ patreon_donation_prompt_enabled: "Aktivera donationsuppmaning?"
+ patreon_donation_prompt_show_after_topics: "Visa donationsuppmaning efter n ämnen"
+ patreon_donation_prompt_campaign_url: "Donationsuppmaningskampanj-URL"
+ errors:
+ patreon_creator_username_not_set: "Du måste ange inställningen för Patreon-skaparens Discourse-användarnamn innan du aktiverar Patreon-inloggning."
+ patreon:
+ error:
+ invalid_response: "Ogiltigt svar från Patreon-API"
diff --git a/plugins/discourse-patreon/config/locales/server.sw.yml b/plugins/discourse-patreon/config/locales/server.sw.yml
new file mode 100644
index 00000000000..ac72a73e2bb
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.sw.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sw:
+ site_settings:
+ patreon_enabled: 'Ruhusu plugin ya discourse-patreon '
+ patreon_login_enabled: 'Ruhusu watu kuingia kupitia Patreon'
+ patreon_client_id: 'Utambulisho wa Mteja wa Patreon Uliotengenezwa'
+ patreon_creator_discourse_username: "Jina la mtumiaji kutoka kwenye Akaunti ya Discourse ambalo limetumika kutengeneza akaunti ya Patreon kupitia 'Patreon Social Login'"
+ patreon_declined_pledges_grace_period_days: "Mda fulani (siku) kabla ya ombi kukataliwa kabisa."
+ max_patreon_api_reqs_per_day: "Kiwango cha juu cha maombi kwa Patreon API kwa siku"
diff --git a/plugins/discourse-patreon/config/locales/server.te.yml b/plugins/discourse-patreon/config/locales/server.te.yml
new file mode 100644
index 00000000000..03967bdbb07
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.te.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+te:
diff --git a/plugins/discourse-patreon/config/locales/server.th.yml b/plugins/discourse-patreon/config/locales/server.th.yml
new file mode 100644
index 00000000000..7de85ff91c4
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.th.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+th:
diff --git a/plugins/discourse-patreon/config/locales/server.tr_TR.yml b/plugins/discourse-patreon/config/locales/server.tr_TR.yml
new file mode 100644
index 00000000000..c4f5efbf71a
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.tr_TR.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+tr_TR:
+ site_settings:
+ patreon_enabled: 'Discourse-patreon eklentisini etkinleştir'
+ patreon_login_enabled: 'Patreon Sosyal Girişini Etkinleştir'
+ patreon_client_id: 'Oluşturulan Patreon İstemci Kimliği'
+ patreon_client_secret: 'Oluşturulan Patreon İstemcisi Gizliliği'
+ patreon_webhook_secret: 'Oluşturulan Patreon Web Kancası Sırrı'
+ patreon_creator_discourse_username: "\"Patreon Sosyal Girişi\" kullanılarak Patreon oluşturucu hesabı üzerinden giriş yapmak için kullanılan Discourse hesabının kullanıcı adı"
+ patreon_creator_access_token: "Oluşturulan Patreon Oluşturucusunun Erişim Token'ı"
+ patreon_creator_refresh_token: "Oluşturulan Patreon Oluşturucusunun Refesh Token'ı"
+ patreon_declined_pledges_grace_period_days: "Bir bağış tamamen reddedilmeden önceki bekleme süresi (gün cinsinden)."
+ max_patreon_api_reqs_per_hr: "Saat başına maksimum Patreon API isteği sayısı"
+ max_patreon_api_reqs_per_day: "Günlük maksimum Patreon API isteği sayısı"
+ patreon_verbose_log: 'patreon yükünün ayrıntılı günlük kaydını etkinleştirin'
+ patreon_donation_prompt_enabled: "Bağış istemi etkinleştirilsin mi?"
+ patreon_donation_prompt_show_after_topics: "N konudan sonra bağış istemini göster"
+ patreon_donation_prompt_campaign_url: "Bağış istemi kampanyasının URL'si"
+ errors:
+ patreon_creator_username_not_set: "Patreon Girişini etkinleştirmeden önce Patreon Üreticisi Discourse Kullanıcı Adı ayarını yapmanız gerekir."
+ dashboard:
+ problem:
+ access_token_invalid: "Patreon Creator'ın erişim ve yenileme token değerleri yanlış. Yeni token'ları <a href='https://www.patreon.com/platform/documentation/clients'>Patreon web sitesinden</a> kopyalayıp <a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>site ayarlarına</a> yapıştırmalısınız."
+ patreon:
+ error:
+ invalid_response: "Patreon API'den geçersiz yanıt"
diff --git a/plugins/discourse-patreon/config/locales/server.ug.yml b/plugins/discourse-patreon/config/locales/server.ug.yml
new file mode 100644
index 00000000000..a6bf0185ae2
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.ug.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ug:
diff --git a/plugins/discourse-patreon/config/locales/server.uk.yml b/plugins/discourse-patreon/config/locales/server.uk.yml
new file mode 100644
index 00000000000..405764660bf
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.uk.yml
@@ -0,0 +1,23 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+uk:
+ site_settings:
+ patreon_enabled: 'Увімкніть discourse-patreon плагін'
+ patreon_login_enabled: 'Увімкнути соціальний вхід з Patreon'
+ patreon_client_id: 'Створений Patreon Client ID'
+ patreon_client_secret: 'Створений Patreon Client Secret'
+ patreon_webhook_secret: 'Створений Patreon Webhook Secret'
+ patreon_creator_discourse_username: "Ім’я користувача облікового запису «Discourse», який використовується для входу через обліковий запис Patreon, використовуючи «Patreon Social Login»"
+ max_patreon_api_reqs_per_hr: "Максимальна кількість запитів Patreon API на годину"
+ max_patreon_api_reqs_per_day: "Максимальна кількість запитів Patreon API на день"
+ patreon_verbose_log: 'увімкнути детальний журнал оплат Patreon'
+ patreon_donation_prompt_enabled: "Увімкнути підказку про пожертвування?"
+ patreon_donation_prompt_show_after_topics: "Показати запит на пожертвування після n тем"
+ patreon_donation_prompt_campaign_url: "URL-адреса кампанії з швидким пожертвуванням"
+ patreon:
+ error:
+ invalid_response: "Неправильна відповідь від API Patreon"
diff --git a/plugins/discourse-patreon/config/locales/server.ur.yml b/plugins/discourse-patreon/config/locales/server.ur.yml
new file mode 100644
index 00000000000..b14d3a8d334
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.ur.yml
@@ -0,0 +1,23 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ur:
+ site_settings:
+ patreon_enabled: 'ڈسکورس-پَیٹریئون پلگ اِن کو فعال کریں'
+ patreon_login_enabled: 'پَیٹریئون سوشل لاگ اِن کو فعال کریں'
+ patreon_client_id: 'پَیٹریئون کلائنٹ ID تیار کرلی گئی'
+ patreon_client_secret: 'پَیٹریئون کلائنٹ سیکرٹ تیار کرلیا گیا'
+ patreon_webhook_secret: 'پَیٹریئون وَیب ہوک سیکرٹ تیار کرلیا گیا'
+ patreon_creator_discourse_username: "ڈسکورس اکاؤنٹ کا صارف نام جسے 'پَیٹریئون سماجی لاگ اِن' کا استعمال کرتے ہوئے پَیٹریئون کرِییٹر اکاؤنٹ کے ذریعہ لاگ ان کرنے کے لئے استعمال کیا جاتا ہے۔"
+ patreon_creator_access_token: "پَیٹریئون کرِییٹر اِکسس ٹوکن تیار کرلیا گیا"
+ patreon_creator_refresh_token: "پَیٹریئون کرِییٹر ریفریش ٹوکن تیار کرلیا گیا"
+ patreon_declined_pledges_grace_period_days: "رعایتی مدت (دنوں میں) اِس سے پہلے کہ وعدہ مکمل طور پر رد کر دیا جائے۔"
+ max_patreon_api_reqs_per_hr: "فی گھنٹہ پَیٹریئون API درخواستوں کی زیادہ سے زیادہ تعداد"
+ max_patreon_api_reqs_per_day: "فی دن پَیٹریئون API درخواستوں کی زیادہ سے زیادہ تعداد"
+ patreon_verbose_log: 'پَیٹریئون پَیلوڈ کیلئے تفصیلی لاگِنگ فعال کریں'
+ patreon:
+ error:
+ invalid_response: "پَیٹریئون API کی طرف سے غلط جواب"
diff --git a/plugins/discourse-patreon/config/locales/server.vi.yml b/plugins/discourse-patreon/config/locales/server.vi.yml
new file mode 100644
index 00000000000..ae95dce2bcb
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.vi.yml
@@ -0,0 +1,10 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+vi:
+ site_settings:
+ patreon_login_enabled: 'Kích hoạt đăng nhập xã hội Patreon'
+ patreon_creator_discourse_username: "Tên người dùng của tài khoản Discourse được sử dụng để đăng nhập thông qua tài khoản người tạo Patreon bằng cách sử dụng 'Đăng nhập xã hội Patreon'"
diff --git a/plugins/discourse-patreon/config/locales/server.zh_CN.yml b/plugins/discourse-patreon/config/locales/server.zh_CN.yml
new file mode 100644
index 00000000000..9a2184976f8
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.zh_CN.yml
@@ -0,0 +1,31 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+zh_CN:
+ site_settings:
+ patreon_enabled: '启用 discourse-patreon 插件'
+ patreon_login_enabled: '启用 Patreon 社交登录'
+ patreon_client_id: '生成的 Patreon 客户端 ID'
+ patreon_client_secret: '生成的 Patreon 客户端密钥'
+ patreon_webhook_secret: '生成的 Patreon 网络钩子密钥'
+ patreon_creator_discourse_username: "Discourse 帐户的用户名,用于使用“Patreon 社交登录”通过 Patreon 创作者帐户登录"
+ patreon_creator_access_token: "生成的 Patreon 创作者的访问令牌"
+ patreon_creator_refresh_token: "生成的 Patreon 创作者的刷新令牌"
+ patreon_declined_pledges_grace_period_days: "承诺被完全拒绝之前的宽限期(以天为单位)。"
+ max_patreon_api_reqs_per_hr: "每小时最大 Patreon API 请求数量"
+ max_patreon_api_reqs_per_day: "每天最大 Patreon API 请求数量"
+ patreon_verbose_log: '启用 Patreon 有效负载的详细日志记录'
+ patreon_donation_prompt_enabled: "启用捐助提示?"
+ patreon_donation_prompt_show_after_topics: "在 n 个话题后显示捐助提示"
+ patreon_donation_prompt_campaign_url: "捐助提示活动 URL"
+ errors:
+ patreon_creator_username_not_set: "在启用 Patreon 登录之前,您需要设置 Patreon 创作者 Discourse 用户名设置。"
+ dashboard:
+ problem:
+ access_token_invalid: "Patreon 创作者的访问和刷新令牌值不正确。您必须将新的令牌从 <a href='https://www.patreon.com/platform/documentation/clients'>Patreon 网站</a>复制粘贴到<a href='%{base_path}/admin/site_settings/category/all_results?filter=patreon'>网站设置</a>。"
+ patreon:
+ error:
+ invalid_response: "Patreon API 的响应无效"
diff --git a/plugins/discourse-patreon/config/locales/server.zh_TW.yml b/plugins/discourse-patreon/config/locales/server.zh_TW.yml
new file mode 100644
index 00000000000..7e15fab0018
--- /dev/null
+++ b/plugins/discourse-patreon/config/locales/server.zh_TW.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+zh_TW:
diff --git a/plugins/discourse-patreon/config/settings.yml b/plugins/discourse-patreon/config/settings.yml
new file mode 100644
index 00000000000..125c391f032
--- /dev/null
+++ b/plugins/discourse-patreon/config/settings.yml
@@ -0,0 +1,47 @@
+discourse_patreon:
+ patreon_enabled:
+ default: false
+ client: true
+ patreon_login_enabled:
+ default: false
+ client: true
+ validator: 'PatreonLoginEnabledValidator'
+ patreon_client_id:
+ default: ''
+ patreon_client_secret:
+ default: ''
+ secret: true
+ patreon_webhook_secret:
+ default: ''
+ secret: true
+ patreon_creator_discourse_username:
+ default: ''
+ type: username
+ patreon_creator_access_token:
+ default: ''
+ secret: true
+ patreon_creator_refresh_token:
+ default: ''
+ secret: true
+ patreon_declined_pledges_grace_period_days:
+ default: 7
+ max_patreon_api_reqs_per_hr:
+ default: 100
+ max_patreon_api_reqs_per_day:
+ default: 1000
+ patreon_verbose_log:
+ default: false
+ patreon_login_ignore_state:
+ default: false
+ hidden: true
+ patreon_donation_prompt_enabled:
+ default: false
+ client: true
+ patreon_donation_prompt_show_after_topics:
+ default: 20
+ client: true
+ min: 0
+ patreon_donation_prompt_campaign_url:
+ default: ""
+ client: true
+ regex: "^https?:\\/\\/.+[^\\/]$"
diff --git a/plugins/discourse-patreon/db/migrate/20211230151700_migrate_patreon_user_info.rb b/plugins/discourse-patreon/db/migrate/20211230151700_migrate_patreon_user_info.rb
new file mode 100644
index 00000000000..1d13533d565
--- /dev/null
+++ b/plugins/discourse-patreon/db/migrate/20211230151700_migrate_patreon_user_info.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class MigratePatreonUserInfo < ActiveRecord::Migration[6.1]
+ def up
+ execute <<~SQL
+ INSERT INTO user_associated_accounts (
+ provider_name,
+ provider_uid,
+ user_id,
+ info,
+ last_used,
+ created_at,
+ updated_at
+ ) SELECT
+ 'patreon',
+ uid,
+ user_id,
+ json_build_object('email', email, 'name', name),
+ updated_at,
+ created_at,
+ updated_at
+ FROM oauth2_user_infos
+ WHERE provider = 'patreon'
+ ON CONFLICT DO NOTHING
+ SQL
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
diff --git a/plugins/discourse-patreon/db/migrate/20221025153038_deactivate_unverified_email_patreon_accounts.rb b/plugins/discourse-patreon/db/migrate/20221025153038_deactivate_unverified_email_patreon_accounts.rb
new file mode 100644
index 00000000000..061828e4620
--- /dev/null
+++ b/plugins/discourse-patreon/db/migrate/20221025153038_deactivate_unverified_email_patreon_accounts.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class DeactivateUnverifiedEmailPatreonAccounts < ActiveRecord::Migration[6.1]
+ def up
+ execute <<~SQL
+ UPDATE users SET active = false
+ WHERE users.id IN (
+ SELECT user_id FROM user_associated_accounts
+ WHERE provider_name = 'patreon'
+ AND extra -> 'raw_info' -> 'data' -> 'attributes' ->> 'is_email_verified' = 'false'
+ )
+ SQL
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/plugins/discourse-patreon/db/migrate/20221026043851_delete_unverified_patreon_user_info.rb b/plugins/discourse-patreon/db/migrate/20221026043851_delete_unverified_patreon_user_info.rb
new file mode 100644
index 00000000000..75c21feb767
--- /dev/null
+++ b/plugins/discourse-patreon/db/migrate/20221026043851_delete_unverified_patreon_user_info.rb
@@ -0,0 +1,47 @@
+# frozen_string_literal: true
+
+class DeleteUnverifiedPatreonUserInfo < ActiveRecord::Migration[6.1]
+ def up
+ execute <<~SQL
+ DELETE FROM user_auth_tokens
+ WHERE user_id IN (
+ SELECT user_id
+ FROM user_associated_accounts
+ WHERE provider_name = 'patreon'
+ AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'
+ )
+ SQL
+
+ execute <<~SQL
+ UPDATE user_api_keys
+ SET revoked_at = NOW()
+ WHERE user_id IN (
+ SELECT user_id
+ FROM user_associated_accounts
+ WHERE provider_name = 'patreon'
+ AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'
+ )
+ SQL
+
+ execute <<~SQL
+ UPDATE api_keys
+ SET revoked_at = NOW()
+ WHERE created_by_id IN (
+ SELECT user_id
+ FROM user_associated_accounts
+ WHERE provider_name = 'patreon'
+ AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'
+ )
+ SQL
+
+ execute <<~SQL
+ DELETE FROM user_associated_accounts
+ WHERE provider_name = 'patreon'
+ AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'
+ SQL
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/plugins/discourse-patreon/lib/api.rb b/plugins/discourse-patreon/lib/api.rb
new file mode 100644
index 00000000000..7a46d86cf72
--- /dev/null
+++ b/plugins/discourse-patreon/lib/api.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+require "json"
+
+module ::Patreon
+ class InvalidApiResponse < ::StandardError
+ end
+
+ class Api
+ ACCESS_TOKEN_INVALID = "dashboard.patreon.access_token_invalid".freeze
+ INVALID_RESPONSE = "patreon.error.invalid_response".freeze
+
+ def self.campaign_data
+ get(
+ "/oauth2/api/current_user/campaigns?include=rewards,creator,goals,pledges&page[count]=100",
+ )
+ end
+
+ def self.get(uri)
+ limiter_hr =
+ RateLimiter.new(nil, "patreon_api_hr", SiteSetting.max_patreon_api_reqs_per_hr, 1.hour)
+ limiter_day =
+ RateLimiter.new(nil, "patreon_api_day", SiteSetting.max_patreon_api_reqs_per_day, 1.day)
+
+ limiter_hr.performed! unless limiter_hr.can_perform?
+
+ limiter_day.performed! unless limiter_day.can_perform?
+
+ response =
+ Faraday.new(
+ url: "https://api.patreon.com",
+ headers: {
+ "Authorization" => "Bearer #{SiteSetting.patreon_creator_access_token}",
+ },
+ ).get(uri)
+
+ limiter_hr.performed!
+ limiter_day.performed!
+
+ case response.status
+ when 200
+ return JSON.parse response.body
+ when 401
+ ProblemCheckTracker[:access_token_invalid].problem!
+ else
+ e = ::Patreon::InvalidApiResponse.new(response.body.presence || "")
+ e.set_backtrace(caller)
+ Discourse.warn_exception(e, message: I18n.t(INVALID_RESPONSE), env: { api_uri: uri })
+ end
+
+ { error: I18n.t(INVALID_RESPONSE) }
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/lib/campaign.rb b/plugins/discourse-patreon/lib/campaign.rb
new file mode 100644
index 00000000000..b9b20b8e6a3
--- /dev/null
+++ b/plugins/discourse-patreon/lib/campaign.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+require "json"
+
+module ::Patreon
+ class Campaign
+ def self.update!
+ rewards = {}
+ campaign_rewards = []
+ pledges_uris = []
+
+ response = ::Patreon::Api.campaign_data
+
+ return false if response.blank? || response["data"].blank?
+
+ response["data"].map do |campaign|
+ uri = campaign["relationships"]["pledges"]["links"]["first"]
+ pledges_uris << uri.sub("page%5Bcount%5D=20", "page%5Bcount%5D=100")
+
+ campaign["relationships"]["rewards"]["data"].each do |entry|
+ campaign_rewards << entry["id"]
+ end
+ end
+
+ response["included"].each do |entry|
+ id = entry["id"]
+ if entry["type"] == "reward" && campaign_rewards.include?(id)
+ rewards[id] = entry["attributes"]
+ rewards[id]["id"] = id
+ end
+ end
+
+ # Special catch all patrons virtual reward
+ rewards["0"] ||= {}
+ rewards["0"]["title"] = "All Patrons"
+ rewards["0"]["amount_cents"] = 0
+
+ Patreon.set("rewards", rewards)
+
+ Patreon::Pledge.pull!(pledges_uris)
+
+ # Sets all patrons to the seed group by default on first run
+ filters = Patreon.get("filters")
+ Patreon::Seed.seed_content! if filters.blank?
+
+ true
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/lib/patron.rb b/plugins/discourse-patreon/lib/patron.rb
new file mode 100644
index 00000000000..95e24a3dddd
--- /dev/null
+++ b/plugins/discourse-patreon/lib/patron.rb
@@ -0,0 +1,184 @@
+# frozen_string_literal: true
+
+require "json"
+
+module ::Patreon
+ class Patron
+ def self.update!
+ return unless Patreon::Campaign.update!
+ sync_groups
+
+ rewards = Patreon.get("rewards")
+ ::MessageBus.publish "/patreon/background_sync", rewards
+ end
+
+ def self.sync_groups
+ filters = Patreon.get("filters") || {}
+ return if filters.blank?
+
+ local_users = get_local_users
+ reward_users = Patreon::RewardUser.all
+ declined_users = Patreon::Pledge::Decline.all
+ declined_pledges_grace_period_days = SiteSetting.patreon_declined_pledges_grace_period_days
+
+ filters.each_pair do |group_id, rewards|
+ group = Group.find_by(id: group_id)
+
+ next if group.nil?
+
+ patron_ids = rewards.map { |id| reward_users[id] }.compact.flatten.uniq
+
+ next if patron_ids.blank?
+
+ user_ids =
+ local_users
+ .select do |_, patreon_id|
+ is_declined = false
+ declined_since = declined_users[patreon_id]
+
+ if declined_since.present?
+ declined_days_count = Time.now.to_date - declined_since.to_date
+ is_declined = declined_days_count > declined_pledges_grace_period_days
+ end
+
+ patreon_id.present? && patron_ids.include?(patreon_id) && !is_declined
+ end
+ .pluck(0)
+
+ group_user_ids = GroupUser.where(group: group).pluck(:user_id)
+
+ User.where(id: (user_ids - group_user_ids)).each { |user| group.add user }
+
+ User.where(id: (group_user_ids - user_ids)).each { |user| group.remove user }
+ end
+ end
+
+ def self.sync_groups_by(patreon_id:)
+ filters = Patreon.get("filters") || {}
+ return if filters.blank?
+
+ user = get_local_user(patreon_id)
+ return if user.blank?
+
+ reward_users = Patreon::RewardUser.all
+ declined_since = Patreon::Pledge::Decline.all[patreon_id]
+ declined_pledges_grace_period_days = SiteSetting.patreon_declined_pledges_grace_period_days
+ is_member = true
+
+ if declined_since.present?
+ declined_days_count = Time.now.to_date - declined_since.to_date
+ is_member = false if declined_days_count > declined_pledges_grace_period_days
+ end
+
+ filters.each_pair do |group_id, rewards|
+ group = Group.find_by(id: group_id)
+ next if group.blank?
+
+ if is_member
+ patron_ids = rewards.map { |id| reward_users[id] }.compact.flatten.uniq
+ next if patron_ids.blank?
+
+ is_member = false if patron_ids.exclude?(patreon_id)
+ end
+
+ is_existing_member = GroupUser.exists?(group: group, user: user)
+
+ if is_member && !is_existing_member
+ group.add user
+ elsif !is_member && is_existing_member
+ group.remove user
+ end
+ end
+ end
+
+ def self.all
+ Patreon.get("users") || {}
+ end
+
+ def self.update_local_user(user, patreon_id, skip_save = false)
+ return if user.blank?
+
+ user.custom_fields["patreon_id"] = patreon_id
+ user.save_custom_fields unless skip_save || user.custom_fields_clean?
+
+ user
+ end
+
+ def self.attr(name, user)
+ id = user.custom_fields["patreon_id"]
+ return if id.blank?
+
+ case name
+ when "email"
+ all[id]
+ when "amount_cents"
+ Patreon::Pledge.all[id]
+ when "rewards"
+ reward_users = Patreon::RewardUser.all
+ Patreon::Reward
+ .all
+ .map { |i, r| r["title"] if reward_users[i].include?(id) }
+ .compact
+ .join(", ")
+ when "declined_since"
+ Patreon::Pledge::Decline.all[id]
+ else
+ id
+ end
+ end
+
+ def self.get_local_users
+ users =
+ User.joins(
+ "INNER JOIN user_custom_fields cf ON cf.user_id = users.id AND cf.name = 'patreon_id'",
+ ).pluck("users.id, cf.value")
+ patrons = all.slice!(*users.pluck(1))
+
+ oauth_users = UserAssociatedAccount.includes(:user).where(provider_name: "patreon")
+ oauth_users = oauth_users.where("provider_uid IN (?)", patrons.keys) if patrons.present?
+
+ users +=
+ oauth_users.map do |o|
+ patrons = patrons.slice!(o.provider_uid)
+ update_local_user(o.user, o.provider_uid)
+ [o.user_id, o.provider_uid]
+ end
+
+ emails = patrons.values.map { |e| e.downcase }
+ users +=
+ UserEmail
+ .includes(:user)
+ .where(email: emails)
+ .map do |u|
+ patreon_id = patrons.key(u.email)
+ update_local_user(u.user, patreon_id)
+ [u.user_id, patreon_id]
+ end
+
+ users.compact
+ end
+
+ def self.get_local_user(patreon_id)
+ user =
+ User.joins(:_custom_fields).find_by(
+ user_custom_fields: {
+ name: "patreon_id",
+ value: patreon_id,
+ },
+ )
+ return user if user.present?
+
+ user =
+ User.joins(:user_associated_accounts).find_by(
+ user_associated_accounts: {
+ provider_name: "patreon",
+ provider_uid: patreon_id,
+ },
+ )
+ user ||= User.joins(:user_emails).find_by(user_emails: { email: all[patreon_id] })
+ return if user.blank?
+
+ update_local_user(user, patreon_id)
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/lib/pledge.rb b/plugins/discourse-patreon/lib/pledge.rb
new file mode 100644
index 00000000000..346dd063e8f
--- /dev/null
+++ b/plugins/discourse-patreon/lib/pledge.rb
@@ -0,0 +1,149 @@
+# frozen_string_literal: true
+
+module ::Patreon
+ class Pledge
+ def self.create!(pledge_data)
+ save!([pledge_data], true)
+ end
+
+ def self.update!(pledge_data)
+ delete!(pledge_data)
+ create!(pledge_data)
+ end
+
+ def self.delete!(pledge_data)
+ entry = pledge_data["data"]
+ rel = entry["relationships"]
+ reward_users = Patreon::RewardUser.all
+
+ if entry["type"] == "pledge"
+ patron_id = rel["patron"]["data"]["id"]
+ reward_id = rel["reward"]["data"]["id"] if rel["reward"]["data"].present?
+
+ reward_users[reward_id].reject! { |i| i == patron_id } if reward_id.present?
+ elsif entry["type"] == "member"
+ patron_id = rel["user"]["data"]["id"]
+
+ (rel["currently_entitled_tiers"]["data"] || []).each do |tier|
+ (reward_users[tier["id"]] || []).reject! { |i| i == patron_id }
+ end
+ end
+
+ Patreon.set("pledges", all.except(patron_id))
+ Decline.set(Decline.all.except(patron_id))
+ Patreon.set("users", Patreon::Patron.all.except(patron_id))
+ Patreon.set("reward-users", reward_users)
+ end
+
+ def self.pull!(uris)
+ pledges_data = []
+
+ uris.each do |uri|
+ pledge_data = ::Patreon::Api.get(uri)
+
+ # get next page if necessary and add to the current loop
+ if pledge_data["links"] && pledge_data["links"]["next"]
+ next_page_uri = pledge_data["links"]["next"]
+ uris << next_page_uri if next_page_uri.present?
+ end
+
+ pledges_data << pledge_data if pledge_data.present?
+ end
+
+ save!(pledges_data)
+ end
+
+ def self.save!(pledges_data, is_append = false)
+ pledges = is_append ? all : {}
+ reward_users = is_append ? Patreon::RewardUser.all : {}
+ users = is_append ? Patreon::Patron.all : {}
+ declines = is_append ? Decline.all : {}
+
+ pledges_data.each do |pledge_data|
+ new_pledges, new_declines, new_reward_users, new_users = extract(pledge_data)
+
+ pledges.merge!(new_pledges)
+ declines.merge!(new_declines)
+ users.merge!(new_users)
+
+ Patreon::Reward.all.keys.each do |key|
+ reward_users[key] = (reward_users[key] || []) + (new_reward_users[key] || [])
+ end
+ end
+
+ reward_users["0"] = pledges.keys
+
+ Patreon.set("pledges", pledges)
+ Decline.set(declines)
+ Patreon.set("reward-users", reward_users)
+ Patreon.set("users", users)
+ end
+
+ def self.extract(pledge_data)
+ pledges, declines, reward_users, users = {}, {}, {}, {}
+
+ if pledge_data && pledge_data["data"].present?
+ pledge_data["data"] = [pledge_data["data"]] unless pledge_data["data"].kind_of?(Array)
+
+ # get pledges info
+ pledge_data["data"].each do |entry|
+ if entry["type"] == "pledge"
+ patron_id = entry["relationships"]["patron"]["data"]["id"]
+ attrs = entry["attributes"]
+
+ (
+ reward_users[entry["relationships"]["reward"]["data"]["id"]] ||= []
+ ) << patron_id unless entry["relationships"]["reward"]["data"].nil?
+ pledges[patron_id] = attrs["amount_cents"]
+ declines[patron_id] = attrs["declined_since"] if attrs["declined_since"].present?
+ elsif entry["type"] == "member"
+ patron_id = entry["relationships"]["user"]["data"]["id"]
+ attrs = entry["attributes"]
+
+ currently_entitled_tiers = entry["relationships"]["currently_entitled_tiers"] || {}
+ (currently_entitled_tiers["data"] || []).each do |tier|
+ (reward_users[tier["id"]] ||= []) << patron_id
+ end
+ pledges[patron_id] = attrs["pledge_amount_cents"]
+ declines[patron_id] = attrs["last_charge_date"] if attrs["last_charge_status"] ==
+ "Declined"
+ end
+ end
+
+ # get user list too
+ pledge_data["included"].each do |entry|
+ case entry["type"]
+ when "user"
+ if entry["attributes"]["email"].present?
+ users[entry["id"]] = entry["attributes"]["email"].downcase
+ end
+ end
+ end
+ end
+
+ [pledges, declines, reward_users, users]
+ end
+
+ def self.all
+ Patreon.get("pledges") || {}
+ end
+
+ def self.get_patreon_id(pledge_data)
+ data = pledge_data["data"]
+ key = data["type"] == "member" ? "user" : "patron"
+ data["relationships"][key]["data"]["id"]
+ end
+
+ class Decline
+ KEY = "pledge-declines".freeze
+
+ def self.all
+ Patreon.get(KEY) || {}
+ end
+
+ def self.set(value)
+ Patreon.set(KEY, value)
+ end
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/lib/seed.rb b/plugins/discourse-patreon/lib/seed.rb
new file mode 100644
index 00000000000..9817e544fd7
--- /dev/null
+++ b/plugins/discourse-patreon/lib/seed.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+module ::Patreon
+ class Seed
+ def self.seed_content!
+ flair =
+ File.open(
+ "#{Rails.root}/plugins/discourse-patreon/public/images/patreon-logomark-color-on-white.png",
+ )
+ flair_upload =
+ UploadCreator.new(flair, "patreon-flair.png").create_for(Discourse.system_user.id)
+
+ default_group =
+ Group.where(name: "patrons").first_or_initialize(
+ visibility_level: Group.visibility_levels[:public],
+ primary_group: true,
+ title: "Patron",
+ flair_upload_id: flair_upload.id,
+ bio_raw:
+ "To get access to this group go to our [Patreon page](https://www.patreon.com/) and add your pledge.",
+ full_name: "Our Patreon supporters",
+ )
+ default_group.save!
+
+ badge =
+ Badge.where(name: "Patron").first_or_initialize(
+ description: "Active Patron",
+ badge_type_id: 1,
+ listable: true,
+ target_posts: false,
+ query:
+ "select user_id, created_at granted_at, NULL post_id from group_users where group_id = ( select g.id from groups g where g.name = 'patrons' )",
+ enabled: true,
+ auto_revoke: true,
+ badge_grouping_id: 2,
+ trigger: 0,
+ show_posts: false,
+ system: false,
+ image_upload_id: flair_upload.id,
+ long_description:
+ 'To get access to this badge go to our <a href="https://www.patreon.com/">Patreon page</a> and add your pledge.',
+ )
+ badge.save!
+
+ basic_filter = { default_group.id.to_s => ["0"] }
+ ::Patreon.set("filters", basic_filter)
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/lib/tokens.rb b/plugins/discourse-patreon/lib/tokens.rb
new file mode 100644
index 00000000000..37a6a3ac535
--- /dev/null
+++ b/plugins/discourse-patreon/lib/tokens.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+require "json"
+
+module ::Patreon
+ class Tokens
+ def self.update!
+ conn = Faraday.new(url: "https://api.patreon.com")
+
+ response =
+ conn.post(
+ "/oauth2/token",
+ grant_type: "refresh_token",
+ refresh_token: SiteSetting.patreon_creator_refresh_token,
+ client_id: SiteSetting.patreon_client_id,
+ client_secret: SiteSetting.patreon_client_secret,
+ )
+
+ if response.status == 200
+ tokens = JSON.parse response.body
+ SiteSetting.patreon_creator_access_token = tokens["access_token"]
+ SiteSetting.patreon_creator_refresh_token = tokens["refresh_token"]
+ else
+ Rails.logger.warn(
+ "Patreon token refresh failed with status: #{response.status}.\n\n #{response.body}",
+ )
+ end
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/lib/validators/patreon_login_enabled_validator.rb b/plugins/discourse-patreon/lib/validators/patreon_login_enabled_validator.rb
new file mode 100644
index 00000000000..c57079e42a3
--- /dev/null
+++ b/plugins/discourse-patreon/lib/validators/patreon_login_enabled_validator.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class PatreonLoginEnabledValidator
+ def initialize(opts = {})
+ @opts = opts
+ end
+
+ def valid_value?(val)
+ return true if val == "f"
+ return false if SiteSetting.patreon_creator_discourse_username.blank?
+ true
+ end
+
+ def error_message
+ I18n.t("site_settings.errors.patreon_creator_username_not_set")
+ end
+end
diff --git a/plugins/discourse-patreon/plugin.rb b/plugins/discourse-patreon/plugin.rb
new file mode 100644
index 00000000000..9beb23e21e4
--- /dev/null
+++ b/plugins/discourse-patreon/plugin.rb
@@ -0,0 +1,244 @@
+# frozen_string_literal: true
+
+# name: discourse-patreon
+# about: Enables Patreon Social Login, and synchronization between Discourse Groups and Patreon rewards.
+# meta_topic_id: 44366
+# version: 2.0
+# author: Rafael dos Santos Silva <[email protected]>
+# url: https://github.com/discourse/discourse/tree/main/plugins/discourse-patreon
+
+require "omniauth-oauth2"
+
+enabled_site_setting :patreon_enabled
+
+register_asset "stylesheets/patreon.scss"
+
+register_svg_icon "patreon-new"
+
+# Site setting validators must be loaded before initialize
+require_relative "lib/validators/patreon_login_enabled_validator"
+
+after_initialize do
+ require_dependency "admin_constraint"
+
+ module ::Patreon
+ PLUGIN_NAME = "discourse-patreon".freeze
+ USER_DETAIL_FIELDS = %w[id amount_cents rewards declined_since].freeze
+
+ class Engine < ::Rails::Engine
+ engine_name PLUGIN_NAME
+ isolate_namespace Patreon
+ end
+
+ def self.store
+ @store ||= PluginStore.new(PLUGIN_NAME)
+ end
+
+ def self.get(key)
+ store.get(key)
+ end
+
+ def self.set(key, value)
+ store.set(key, value)
+ end
+
+ def self.show_donation_prompt_to_user?(user)
+ return false unless SiteSetting.patreon_donation_prompt_enabled?
+
+ filters = get("filters") || {}
+ filters = filters.keys.map(&:to_i)
+
+ (user.visible_groups.pluck(:id) & filters).size <= 0
+ end
+
+ class Reward
+ def self.all
+ Patreon.get("rewards") || {}
+ end
+ end
+
+ class RewardUser
+ def self.all
+ Patreon.get("reward-users") || {}
+ end
+ end
+ end
+
+ require_relative "app/controllers/patreon_admin_controller"
+ require_relative "app/controllers/patreon_webhook_controller"
+ require_relative "app/jobs/regular/sync_patron_groups"
+ require_relative "app/jobs/scheduled/patreon_sync_patrons_to_groups"
+ require_relative "app/jobs/scheduled/patreon_update_tokens"
+ require_relative "app/services/problem_check/access_token_invalid"
+ require_relative "lib/api"
+ require_relative "lib/seed"
+ require_relative "lib/campaign"
+ require_relative "lib/pledge"
+ require_relative "lib/patron"
+ require_relative "lib/tokens"
+
+ Patreon::Engine.routes.draw do
+ get "/rewards" => "patreon_admin#rewards", :constraints => AdminConstraint.new
+ get "/list" => "patreon_admin#list", :constraints => AdminConstraint.new
+ post "/list" => "patreon_admin#edit", :constraints => AdminConstraint.new
+ delete "/list" => "patreon_admin#delete", :constraints => AdminConstraint.new
+ post "/sync_groups" => "patreon_admin#sync_groups", :constraints => AdminConstraint.new
+ post "/update_data" => "patreon_admin#update_data", :constraints => AdminConstraint.new
+ post "/webhook" => "patreon_webhook#index"
+ end
+
+ Discourse::Application.routes.prepend { mount ::Patreon::Engine, at: "/patreon" }
+
+ add_admin_route "patreon.title", "patreon"
+
+ Discourse::Application.routes.append do
+ get "/admin/plugins/patreon" => "admin/plugins#index", :constraints => AdminConstraint.new
+ get "/admin/plugins/patreon/list" => "patreon/patreon_admin#list",
+ :constraints => AdminConstraint.new
+ get "/u/:username/patreon_email" => "patreon/patreon_admin#email",
+ :constraints => {
+ username: RouteFormat.username,
+ }
+ end
+
+ on(:user_created) do |user|
+ filters = PluginStore.get(::Patreon::PLUGIN_NAME, "filters")
+ patreon_id = Patreon::Patron.all.key(user.email)
+
+ if filters.present? && patreon_id.present?
+ begin
+ reward_id =
+ Patreon::RewardUser.all.except("0").detect { |_k, v| v.include? patreon_id }&.first
+
+ group_ids = filters.select { |_k, v| v.include?(reward_id) || v.include?("0") }.keys
+
+ Group.where(id: group_ids).each { |group| group.add user }
+
+ Patreon::Patron.update_local_user(user, patreon_id, true)
+ rescue => e
+ Rails.logger.warn(
+ "Patreon group membership callback failed for new user #{self.id} with error: #{e}.\n\n #{e.backtrace.join("\n")}",
+ )
+ end
+ end
+ end
+
+ ::Patreon::USER_DETAIL_FIELDS.each do |attribute|
+ add_to_serializer(
+ :admin_detailed_user,
+ "patreon_#{attribute}".to_sym,
+ include_condition: -> do
+ ::Patreon::Patron.attr(attribute, object).present? &&
+ (attribute != "amount_cents" || scope.is_admin?)
+ end,
+ ) { ::Patreon::Patron.attr(attribute, object) }
+ end
+
+ add_to_serializer(
+ :admin_detailed_user,
+ :patreon_email_exists,
+ include_condition: -> { ::Patreon::Patron.attr("email", object).present? },
+ ) { true }
+
+ add_to_serializer(:current_user, :show_donation_prompt?) do
+ Patreon.show_donation_prompt_to_user?(object)
+ end
+
+ register_problem_check ProblemCheck::AccessTokenInvalid
+end
+
+# Authentication with Patreon
+class ::OmniAuth::Strategies::Patreon < ::OmniAuth::Strategies::OAuth2
+ option :name, "patreon"
+
+ option :client_options,
+ site: "https://www.patreon.com",
+ authorize_url: "https://www.patreon.com/oauth2/authorize",
+ token_url: "https://api.patreon.com/oauth2/token"
+
+ option :authorize_params, response_type: "code"
+
+ def custom_build_access_token
+ verifier = request.params["code"]
+ client.auth_code.get_token(verifier, redirect_uri: options.redirect_uri)
+ end
+
+ alias_method :build_access_token, :custom_build_access_token
+
+ uid { raw_info["data"]["id"].to_s }
+
+ info do
+ {
+ email: raw_info["data"]["attributes"]["email"],
+ email_verified: raw_info["data"]["attributes"]["is_email_verified"],
+ name: raw_info["data"]["attributes"]["full_name"],
+ }
+ end
+
+ extra { { raw_info: raw_info } }
+
+ def raw_info
+ @raw_info ||=
+ begin
+ response =
+ client.request(
+ :get,
+ "https://api.patreon.com/oauth2/api/current_user",
+ headers: {
+ "Authorization" => "Bearer #{access_token.token}",
+ },
+ parse: :json,
+ )
+ response.parsed
+ end
+ end
+
+ def callback_url
+ full_host + script_name + callback_path
+ end
+end
+
+class Auth::PatreonAuthenticator < Auth::ManagedAuthenticator
+ def name
+ "patreon"
+ end
+
+ def register_middleware(omniauth)
+ omniauth.provider :patreon,
+ setup:
+ lambda { |env|
+ strategy = env["omniauth.strategy"]
+ strategy.options[:client_id] = SiteSetting.patreon_client_id
+ strategy.options[:client_secret] = SiteSetting.patreon_client_secret
+ strategy.options[
+ :redirect_uri
+ ] = "#{Discourse.base_url}/auth/patreon/callback"
+ strategy.options[
+ :provider_ignores_state
+ ] = SiteSetting.patreon_login_ignore_state
+ }
+ end
+
+ def after_authenticate(auth_token, existing_account: nil)
+ result = super
+
+ user = result.user
+ discourse_username = SiteSetting.patreon_creator_discourse_username
+ if discourse_username.present? && user && user.username == discourse_username
+ SiteSetting.patreon_creator_access_token = auth_token.credentials["token"]
+ SiteSetting.patreon_creator_refresh_token = auth_token.credentials["refresh_token"]
+ end
+
+ result
+ end
+
+ def enabled?
+ SiteSetting.patreon_login_enabled
+ end
+
+ def primary_email_verified?(auth_token)
+ auth_token[:info][:email_verified]
+ end
+end
+
+auth_provider authenticator: Auth::PatreonAuthenticator.new, icon: "patreon-new"
diff --git a/plugins/discourse-patreon/public/images/patreon-logomark-color-on-navy.png b/plugins/discourse-patreon/public/images/patreon-logomark-color-on-navy.png
new file mode 100644
index 00000000000..10eab781fd8
Binary files /dev/null and b/plugins/discourse-patreon/public/images/patreon-logomark-color-on-navy.png differ
diff --git a/plugins/discourse-patreon/public/images/patreon-logomark-color-on-white.png b/plugins/discourse-patreon/public/images/patreon-logomark-color-on-white.png
new file mode 100644
index 00000000000..d6d1e045ad4
Binary files /dev/null and b/plugins/discourse-patreon/public/images/patreon-logomark-color-on-white.png differ
diff --git a/plugins/discourse-patreon/public/images/patreon-wordmark-navy.png b/plugins/discourse-patreon/public/images/patreon-wordmark-navy.png
new file mode 100644
index 00000000000..800430632c4
Binary files /dev/null and b/plugins/discourse-patreon/public/images/patreon-wordmark-navy.png differ
diff --git a/plugins/discourse-patreon/spec/fixtures/campaigns.json b/plugins/discourse-patreon/spec/fixtures/campaigns.json
new file mode 100644
index 00000000000..c2b6b99f03d
--- /dev/null
+++ b/plugins/discourse-patreon/spec/fixtures/campaigns.json
@@ -0,0 +1,260 @@
+{
+ "data": [{
+ "attributes": {
+ "created_at": "2017-10-20T21:39:01+00:00",
+ "creation_count": 0,
+ "creation_name": "Documentation",
+ "discord_server_id": null,
+ "display_patron_goals": false,
+ "earnings_visibility": "public",
+ "image_small_url": null,
+ "image_url": null,
+ "is_charged_immediately": false,
+ "is_monthly": false,
+ "is_nsfw": false,
+ "is_plural": false,
+ "main_video_embed": null,
+ "main_video_url": null,
+ "one_liner": null,
+ "outstanding_payment_amount_cents": 0,
+ "patron_count": 0,
+ "pay_per_name": null,
+ "pledge_sum": 0,
+ "pledge_url": "/bePatron?c=0000000",
+ "published_at": "2017-10-20T21:49:31+00:00",
+ "summary": null,
+ "thanks_embed": null,
+ "thanks_msg": null,
+ "thanks_video_url": null
+ },
+ "id": "0000000",
+ "relationships": {
+ "creator": {
+ "data": {
+ "id": "1111111",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/1111111"
+ }
+ },
+ "goals": {
+ "data": []
+ },
+ "rewards": {
+ "data": [{
+ "id": "-1",
+ "type": "reward"
+ },
+ {
+ "id": "0",
+ "type": "reward"
+ },
+ {
+ "id": "999997",
+ "type": "reward"
+ },
+ {
+ "id": "999998",
+ "type": "reward"
+ },
+ {
+ "id": "999999",
+ "type": "reward"
+ }
+ ]
+ },
+ "pledges": {
+ "links": {
+ "first": "https://www.patreon.com/api/oauth2/api/campaigns/70261/pledges?page%5Bcount%5D=20&sort=created",
+ "next": "https://www.patreon.com/api/oauth2/api/campaigns/70261/pledges?page%5Bcount%5D=20&sort=created&page%5Bcursor%5D=2017-08-21T20%3A16%3A49.258893%2B00%3A00"
+ }
+ }
+ },
+ "type": "campaign"
+ }],
+ "included": [{
+ "attributes": {
+ "about": null,
+ "created": "2017-10-20T21:36:23+00:00",
+ "discord_id": null,
+ "email": "[email protected]",
+ "facebook": null,
+ "facebook_id": null,
+ "first_name": "Corgi",
+ "full_name": "Corgi The Dev",
+ "gender": 0,
+ "has_password": true,
+ "image_url": "https://c8.patreon.com/2/400/1111111",
+ "is_deleted": false,
+ "is_email_verified": false,
+ "is_nuked": false,
+ "is_suspended": false,
+ "last_name": "The Dev",
+ "social_connections": {
+ "deviantart": null,
+ "discord": null,
+ "facebook": null,
+ "spotify": null,
+ "twitch": null,
+ "twitter": null,
+ "youtube": null
+ },
+ "thumb_url": "https://c8.patreon.com/2/100/1111111",
+ "twitch": null,
+ "twitter": null,
+ "url": "https://www.patreon.com/drkthedev",
+ "vanity": "drkthedev",
+ "youtube": null
+ },
+ "id": "1111111",
+ "relationships": {
+ "campaign": {
+ "data": {
+ "id": "0000000",
+ "type": "campaign"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/campaigns/0000000"
+ }
+ }
+ },
+ "type": "user"
+ },
+ {
+ "attributes": {
+ "amount": 0,
+ "amount_cents": 0,
+ "created_at": null,
+ "description": "Everyone",
+ "id": "-1",
+ "remaining": 0,
+ "requires_shipping": false,
+ "type": "reward",
+ "url": null,
+ "user_limit": null
+ },
+ "id": "-1",
+ "relationships": {
+ "creator": {
+ "data": {
+ "id": "1111111",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/1111111"
+ }
+ }
+ },
+ "type": "reward"
+ },
+ {
+ "attributes": {
+ "amount": 1,
+ "amount_cents": 1,
+ "created_at": null,
+ "description": "Patrons Only",
+ "id": "0",
+ "remaining": 0,
+ "requires_shipping": false,
+ "type": "reward",
+ "url": null,
+ "user_limit": null
+ },
+ "id": "0",
+ "relationships": {
+ "creator": {
+ "data": {
+ "id": "1111111",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/1111111"
+ }
+ }
+ },
+ "type": "reward"
+ },
+ {
+ "attributes": {
+ "amount": 10,
+ "amount_cents": 10,
+ "created_at": null,
+ "description": "Standard",
+ "id": "0",
+ "remaining": 0,
+ "requires_shipping": false,
+ "type": "reward",
+ "url": null,
+ "user_limit": null
+ },
+ "id": "999997",
+ "relationships": {
+ "creator": {
+ "data": {
+ "id": "1111111",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/1111111"
+ }
+ }
+ },
+ "type": "reward"
+ },
+ {
+ "attributes": {
+ "amount": 100,
+ "amount_cents": 100,
+ "created_at": null,
+ "description": "Pro",
+ "id": "0",
+ "remaining": 0,
+ "requires_shipping": false,
+ "type": "reward",
+ "url": null,
+ "user_limit": null
+ },
+ "id": "999998",
+ "relationships": {
+ "creator": {
+ "data": {
+ "id": "1111111",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/1111111"
+ }
+ }
+ },
+ "type": "reward"
+ },
+ {
+ "attributes": {
+ "amount": 1000,
+ "amount_cents": 1000,
+ "created_at": null,
+ "description": "Premium",
+ "id": "0",
+ "remaining": 0,
+ "requires_shipping": false,
+ "type": "reward",
+ "url": null,
+ "user_limit": null
+ },
+ "id": "999999",
+ "relationships": {
+ "creator": {
+ "data": {
+ "id": "1111111",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/1111111"
+ }
+ }
+ },
+ "type": "reward"
+ }
+ ]
+}
diff --git a/plugins/discourse-patreon/spec/fixtures/member.json b/plugins/discourse-patreon/spec/fixtures/member.json
new file mode 100644
index 00000000000..9e02639f084
--- /dev/null
+++ b/plugins/discourse-patreon/spec/fixtures/member.json
@@ -0,0 +1,97 @@
+{
+ "data": {
+ "attributes": {
+ "currently_entitled_amount_cents": null,
+ "full_name": "Platform",
+ "is_follower": true,
+ "last_charge_date": null,
+ "last_charge_status": null,
+ "lifetime_support_cents": 0,
+ "note": "",
+ "patron_status": null,
+ "pledge_relationship_start": null
+ },
+ "id": "d485d5ac-6c82-42c6-9c08-c50cf01b73d7",
+ "relationships": {
+ "address": {
+ "data": null
+ },
+ "campaign": {
+ "data": {
+ "id": "123456",
+ "type": "campaign"
+ }
+ },
+ "currently_entitled_tiers": {
+ "data": []
+ },
+ "user": {
+ "data": {
+ "id": "987654321",
+ "type": "user"
+ }
+ }
+ },
+ "type": "member"
+ },
+ "included": [
+ {
+ "attributes": {
+ "about": "sample text about",
+ "created": "2015-01-15T07:25:51+00:00",
+ "email": "[email protected]",
+ "facebook": null,
+ "first_name": "Roo",
+ "full_name": "Roo Aar",
+ "gender": 1,
+ "image_url": "",
+ "is_email_verified": true,
+ "last_name": "Aar",
+ "social_connections": {
+ "deviantart": null,
+ "discord": null,
+ "facebook": null,
+ "spotify": null,
+ "twitch": null,
+ "twitter": null,
+ "youtube": null
+ },
+ "thumb_url": "",
+ "twitch": null,
+ "twitter": "roo",
+ "url": "https://www.patreon.com/foo",
+ "vanity": "roo",
+ "youtube": null
+ },
+ "id": "987654321",
+ "type": "user"
+ },
+ {
+ "attributes": {
+ "amount": 1,
+ "amount_cents": 1,
+ "created_at": null,
+ "description": "Patrons Only",
+ "id": "999999",
+ "remaining": 0,
+ "requires_shipping": false,
+ "type": "reward",
+ "url": null,
+ "user_limit": null
+ },
+ "id": "999999",
+ "relationships": {
+ "creator": {
+ "data": {
+ "id": "1111111",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/1111111"
+ }
+ }
+ },
+ "type": "reward"
+ }
+ ]
+}
diff --git a/plugins/discourse-patreon/spec/fixtures/pledge.json b/plugins/discourse-patreon/spec/fixtures/pledge.json
new file mode 100644
index 00000000000..cd1302709fd
--- /dev/null
+++ b/plugins/discourse-patreon/spec/fixtures/pledge.json
@@ -0,0 +1,107 @@
+{
+ "data": {
+ "attributes": {
+ "amount_cents": 250,
+ "created_at": "2015-05-18T23:50:42+00:00",
+ "declined_since": null,
+ "patron_pays_fees": false,
+ "pledge_cap_cents": null
+ },
+ "id": "1",
+ "relationships": {
+ "address": {
+ "data": null
+ },
+ "card": {
+ "data": null
+ },
+ "creator": {
+ "data": {
+ "id": "3024102",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/3024102"
+ }
+ },
+ "patron": {
+ "data": {
+ "id": "32187",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/32187"
+ }
+ },
+ "reward": {
+ "data": {
+ "id": "999999",
+ "type": "reward"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/rewards/599336"
+ }
+ }
+ },
+ "type": "pledge"
+ },
+ "included": [{
+ "attributes": {
+ "about": "sample text about",
+ "created": "2015-01-15T07:25:51+00:00",
+ "email": "[email protected]",
+ "facebook": null,
+ "first_name": "Roo",
+ "full_name": "Roo Aar",
+ "gender": 1,
+ "image_url": "",
+ "is_email_verified": true,
+ "last_name": "Aar",
+ "social_connections": {
+ "deviantart": null,
+ "discord": null,
+ "facebook": null,
+ "spotify": null,
+ "twitch": null,
+ "twitter": null,
+ "youtube": null
+ },
+ "thumb_url": "",
+ "twitch": null,
+ "twitter": "roo",
+ "url": "https://www.patreon.com/foo",
+ "vanity": "roo",
+ "youtube": null
+ },
+ "id": "32187",
+ "type": "user"
+ },
+ {
+ "attributes": {
+ "amount": 1,
+ "amount_cents": 1,
+ "created_at": null,
+ "description": "Patrons Only",
+ "id": "999999",
+ "remaining": 0,
+ "requires_shipping": false,
+ "type": "reward",
+ "url": null,
+ "user_limit": null
+ },
+ "id": "999999",
+ "relationships": {
+ "creator": {
+ "data": {
+ "id": "1111111",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/1111111"
+ }
+ }
+ },
+ "type": "reward"
+ }
+ ]
+}
diff --git a/plugins/discourse-patreon/spec/fixtures/pledges.json b/plugins/discourse-patreon/spec/fixtures/pledges.json
new file mode 100644
index 00000000000..5d95816989d
--- /dev/null
+++ b/plugins/discourse-patreon/spec/fixtures/pledges.json
@@ -0,0 +1,183 @@
+{
+ "data": [
+ {
+ "attributes": {
+ "amount_cents": 0,
+ "created_at": "2016-07-25T20:59:52+00:00",
+ "declined_since": null,
+ "patron_pays_fees": false,
+ "pledge_cap_cents": null
+ },
+ "id": "2745627",
+ "relationships": {
+ "patron": {
+ "data": {
+ "id": "111111",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/111111"
+ }
+ },
+ "reward": {
+ "data": {
+ "id": "999999"
+ }
+ }
+ },
+ "type": "pledge"
+ },
+ {
+ "attributes": {
+ "amount_cents": 100,
+ "created_at": "2016-08-25T20:59:52+00:00",
+ "declined_since": "2017-11-07T20:59:52+00:00",
+ "patron_pays_fees": false,
+ "pledge_cap_cents": null
+ },
+ "id": "2745628",
+ "relationships": {
+ "patron": {
+ "data": {
+ "id": "111112",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/111112"
+ }
+ },
+ "reward": {
+ "data": {
+ "id": "999998"
+ }
+ }
+ },
+ "type": "pledge"
+ },
+ {
+ "attributes": {
+ "amount_cents": 200,
+ "created_at": "2017-01-15T20:59:52+00:00",
+ "declined_since": "2017-11-10T20:59:52+00:00",
+ "patron_pays_fees": false,
+ "pledge_cap_cents": null
+ },
+ "id": "2745629",
+ "relationships": {
+ "patron": {
+ "data": {
+ "id": "111113",
+ "type": "user"
+ },
+ "links": {
+ "related": "https://www.patreon.com/api/user/111113"
+ }
+ },
+ "reward": {
+ "data": {
+ "id": "999997"
+ }
+ }
+ },
+ "type": "pledge"
+ }
+ ],
+ "included": [
+ {
+ "attributes": {
+ "about": "sample about text",
+ "created": "2015-01-15T07:25:51+00:00",
+ "email": "[email protected]",
+ "facebook": null,
+ "first_name": "Foo",
+ "full_name": "Foo Bar",
+ "gender": 1,
+ "image_url": "",
+ "is_email_verified": true,
+ "last_name": "Bar",
+ "social_connections": {
+ "deviantart": null,
+ "discord": null,
+ "facebook": null,
+ "spotify": null,
+ "twitch": null,
+ "twitter": null,
+ "youtube": null
+ },
+ "thumb_url": "",
+ "twitch": null,
+ "twitter": "foo",
+ "url": "https://www.patreon.com/foo",
+ "vanity": "foo",
+ "youtube": null
+ },
+ "id": "111111",
+ "type": "user"
+ },
+ {
+ "attributes": {
+ "about": "about text sample",
+ "created": "2015-01-15T07:25:51+00:00",
+ "email": "[email protected]",
+ "facebook": null,
+ "first_name": "Boo",
+ "full_name": "Boo Far",
+ "gender": 1,
+ "image_url": "",
+ "is_email_verified": true,
+ "last_name": "Far",
+ "social_connections": {
+ "deviantart": null,
+ "discord": null,
+ "facebook": null,
+ "spotify": null,
+ "twitch": null,
+ "twitter": null,
+ "youtube": null
+ },
+ "thumb_url": "",
+ "twitch": null,
+ "twitter": "boo",
+ "url": "https://www.patreon.com/boo",
+ "vanity": "boo",
+ "youtube": null
+ },
+ "id": "111112",
+ "type": "user"
+ },
+ {
+ "attributes": {
+ "about": "sample text about",
+ "created": "2015-01-15T07:25:51+00:00",
+ "email": "[email protected]",
+ "facebook": null,
+ "first_name": "Roo",
+ "full_name": "Roo Aar",
+ "gender": 1,
+ "image_url": "",
+ "is_email_verified": true,
+ "last_name": "Aar",
+ "social_connections": {
+ "deviantart": null,
+ "discord": null,
+ "facebook": null,
+ "spotify": null,
+ "twitch": null,
+ "twitter": null,
+ "youtube": null
+ },
+ "thumb_url": "",
+ "twitch": null,
+ "twitter": "roo",
+ "url": "https://www.patreon.com/foo",
+ "vanity": "roo",
+ "youtube": null
+ },
+ "id": "111113",
+ "type": "user"
+ }
+ ],
+ "meta": {
+ "count": 18
+ }
+}
diff --git a/plugins/discourse-patreon/spec/fixtures/tokens.json b/plugins/discourse-patreon/spec/fixtures/tokens.json
new file mode 100644
index 00000000000..b3306c6bb91
--- /dev/null
+++ b/plugins/discourse-patreon/spec/fixtures/tokens.json
@@ -0,0 +1,7 @@
+{
+ "access_token": "ACCESS TOKEN",
+ "refresh_token": "REFRESH TOKEN",
+ "expires_in": "TOKEN LIFETIME DURATION",
+ "scope": "TOKEN SCOPES",
+ "token_type": "Bearer"
+}
diff --git a/plugins/discourse-patreon/spec/integration/patreon_auth_spec.rb b/plugins/discourse-patreon/spec/integration/patreon_auth_spec.rb
new file mode 100644
index 00000000000..03cf62d0163
--- /dev/null
+++ b/plugins/discourse-patreon/spec/integration/patreon_auth_spec.rb
@@ -0,0 +1,85 @@
+# frozen_string_literal: true
+
+describe "Patreon Oauth2" do
+ let(:access_token) { "patreon_access_token_448" }
+ let(:client_id) { "abcdef11223344" }
+ let(:client_secret) { "adddcccdddd99922" }
+ let(:temp_code) { "patreon_temp_code_544254" }
+
+ fab!(:user1) { Fabricate(:user) }
+ fab!(:user2) { Fabricate(:user) }
+
+ def setup_patreon_emails_stub(email:, verified:)
+ stub_request(:get, "https://api.patreon.com/oauth2/api/current_user").with(
+ headers: {
+ "Authorization" => "Bearer #{access_token}",
+ },
+ ).to_return(
+ status: 200,
+ body:
+ JSON.dump(
+ data: {
+ id: "493290423324",
+ attributes: {
+ email: email,
+ full_name: "Patron",
+ is_email_verified: verified,
+ },
+ },
+ ),
+ headers: {
+ "Content-Type" => "application/json",
+ },
+ )
+ end
+
+ before do
+ SiteSetting.patreon_creator_discourse_username = user2.username
+ SiteSetting.patreon_login_enabled = true
+ SiteSetting.patreon_client_id = client_id
+ SiteSetting.patreon_client_secret = client_secret
+
+ stub_request(:post, "https://api.patreon.com/oauth2/token").with(
+ body:
+ hash_including(
+ "client_id" => client_id,
+ "client_secret" => client_secret,
+ "code" => temp_code,
+ "grant_type" => "authorization_code",
+ "redirect_uri" => "http://test.localhost/auth/patreon/callback",
+ ),
+ ).to_return(
+ status: 200,
+ body: Rack::Utils.build_query(access_token: access_token),
+ headers: {
+ "Content-Type" => "application/x-www-form-urlencoded",
+ },
+ )
+ end
+
+ it "doesn't sign in the user if the email from patreon is not verified" do
+ post "/auth/patreon"
+ expect(response.status).to eq(302)
+ expect(response.location).to start_with("https://www.patreon.com/oauth2/authorize")
+
+ setup_patreon_emails_stub(email: user1.email, verified: false)
+
+ post "/auth/patreon/callback", params: { state: session["omniauth.state"], code: temp_code }
+ expect(response.status).to eq(302)
+ expect(response.location).to eq("http://test.localhost/")
+ expect(session[:current_user_id]).to be_blank
+ end
+
+ it "signs in the user if the email from patreon is verified" do
+ post "/auth/patreon"
+ expect(response.status).to eq(302)
+ expect(response.location).to start_with("https://www.patreon.com/oauth2/authorize")
+
+ setup_patreon_emails_stub(email: user1.email, verified: true)
+
+ post "/auth/patreon/callback", params: { state: session["omniauth.state"], code: temp_code }
+ expect(response.status).to eq(302)
+ expect(response.location).to eq("http://test.localhost/")
+ expect(session[:current_user_id]).to eq(user1.id)
+ end
+end
diff --git a/plugins/discourse-patreon/spec/integration/patreon_spec.rb b/plugins/discourse-patreon/spec/integration/patreon_spec.rb
new file mode 100644
index 00000000000..24ec7bad67d
--- /dev/null
+++ b/plugins/discourse-patreon/spec/integration/patreon_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+
+RSpec.describe ::Patreon do
+ let(:user1) { Fabricate(:user) }
+ let(:user2) { Fabricate(:user) }
+ let(:group) { Fabricate(:group) }
+ let(:filters) { { group.id.to_s => [] } }
+
+ before do
+ described_class.set("filters", filters)
+ group.add(user1)
+ end
+
+ context "with donation prompt enabled" do
+ before { SiteSetting.patreon_donation_prompt_enabled = true }
+
+ it "should not show donation prompt to patrons" do
+ expect(described_class.show_donation_prompt_to_user?(user1)).to eq(false)
+ end
+
+ it "should show donation prompt to non-patrons" do
+ expect(described_class.show_donation_prompt_to_user?(user2)).to eq(true)
+ end
+ end
+
+ context "with donation prompt disabled" do
+ before { SiteSetting.patreon_donation_prompt_enabled = false }
+
+ it "should show donation prompt to non-patrons" do
+ expect(described_class.show_donation_prompt_to_user?(user2)).to eq(false)
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/spec/jobs/patreon_update_tokens_spec.rb b/plugins/discourse-patreon/spec/jobs/patreon_update_tokens_spec.rb
new file mode 100644
index 00000000000..cfc283e2950
--- /dev/null
+++ b/plugins/discourse-patreon/spec/jobs/patreon_update_tokens_spec.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+require_relative "../spec_helper"
+
+RSpec.describe Jobs::PatreonUpdateTokens do
+ before do
+ SiteSetting.patreon_enabled = true
+
+ stub_request(:post, "https://api.patreon.com/oauth2/token").with(
+ body: {
+ "client_id" => SiteSetting.patreon_client_id,
+ "client_secret" => SiteSetting.patreon_client_secret,
+ "grant_type" => "refresh_token",
+ "refresh_token" => SiteSetting.patreon_creator_refresh_token,
+ },
+ ).to_return(status: 200, body: get_patreon_response("tokens.json"))
+ end
+
+ it "should update both access and refresh tokens from Patreon" do
+ described_class.new.execute({})
+
+ expect(SiteSetting.patreon_creator_access_token).to eq("ACCESS TOKEN")
+ expect(SiteSetting.patreon_creator_refresh_token).to eq("REFRESH TOKEN")
+ end
+end
diff --git a/plugins/discourse-patreon/spec/lib/api_spec.rb b/plugins/discourse-patreon/spec/lib/api_spec.rb
new file mode 100644
index 00000000000..955cd941ae7
--- /dev/null
+++ b/plugins/discourse-patreon/spec/lib/api_spec.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+
+RSpec.describe ::Patreon::Api do
+ let(:url) do
+ "https://api.patreon.com/oauth2/api/current_user/campaigns?include=rewards,creator,goals,pledges&page%5Bcount%5D=100"
+ end
+
+ def stub(status)
+ content = { status: status, headers: { "Content-Type" => "application/json" }, body: "{}" }
+
+ stub_request(:get, url).to_return(content)
+ end
+
+ before { SiteSetting.stubs(patreon_enabled: true) }
+
+ it "should add admin warning message for invalid api response" do
+ stub(401)
+
+ described_class.get(url)
+
+ expect(ProblemCheckTracker[:access_token_invalid].blips).to eq(1)
+ expect(AdminNotice.find_by(identifier: :access_token_invalid).message).to eq(
+ I18n.t("dashboard.problem.access_token_invalid", base_path: Discourse.base_path),
+ )
+ end
+
+ it "should not add admin warning message for valid api response" do
+ stub(200)
+
+ expect(ProblemCheckTracker[:access_token_invalid].blips).to eq(0)
+ end
+
+ it "should add warning log" do
+ stub(500)
+
+ Discourse.expects(:warn_exception).once
+ expect(described_class.get(url)).to eq(error: I18n.t(described_class::INVALID_RESPONSE))
+ end
+end
diff --git a/plugins/discourse-patreon/spec/lib/campaign_spec.rb b/plugins/discourse-patreon/spec/lib/campaign_spec.rb
new file mode 100644
index 00000000000..5343e7f465d
--- /dev/null
+++ b/plugins/discourse-patreon/spec/lib/campaign_spec.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+require_relative "../spec_helper"
+
+RSpec.describe ::Patreon::Campaign do
+ before do
+ campaigns_url =
+ "https://api.patreon.com/oauth2/api/current_user/campaigns?include=rewards,creator,goals,pledges&page%5Bcount%5D=100"
+ pledges_url =
+ "https://www.patreon.com/api/oauth2/api/campaigns/70261/pledges?page%5Bcount%5D=100&sort=created"
+ content = { status: 200, headers: { "Content-Type" => "application/json" } }
+
+ campaigns = content.merge(body: get_patreon_response("campaigns.json"))
+ pledges = content.merge(body: get_patreon_response("pledges.json"))
+
+ stub_request(:get, campaigns_url).to_return(campaigns)
+ stub_request(:get, pledges_url).to_return(pledges)
+ SiteSetting.patreon_enabled = true
+ SiteSetting.patreon_declined_pledges_grace_period_days = 7
+ end
+
+ it "should update campaigns and group users data" do
+ expect { described_class.update! }.to change { Group.count }.by(1).and change {
+ Badge.count
+ }.by(1)
+
+ expect(Patreon.get("pledges").count).to eq(3)
+ expect(Patreon::Pledge::Decline.all.count).to eq(2)
+ expect(Patreon.get("rewards").count).to eq(5)
+ expect(Patreon.get("users").count).to eq(3)
+ expect(Patreon.get("reward-users")["0"].count).to eq(3)
+ expect(Patreon.get("filters").count).to eq(1)
+
+ # To check `add_model_callback(User, :after_commit, on: :create)` in plugin.rb
+ expect {
+ Patreon
+ .get("users")
+ .each do |id, email|
+ cf = Fabricate(:user, email: email).custom_fields
+ expect(cf["patreon_id"]).to eq(id)
+ end
+ }.to change { GroupUser.count }.by(3)
+ end
+end
diff --git a/plugins/discourse-patreon/spec/lib/patron_spec.rb b/plugins/discourse-patreon/spec/lib/patron_spec.rb
new file mode 100644
index 00000000000..221426be56a
--- /dev/null
+++ b/plugins/discourse-patreon/spec/lib/patron_spec.rb
@@ -0,0 +1,84 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+
+RSpec.describe ::Patreon::Patron do
+ Fabricator(:patreon_user_info, class_name: :user_associated_account) do
+ provider_name "patreon"
+ user
+ end
+
+ let(:patrons) do
+ { "111111" => "[email protected]", "111112" => "[email protected]", "111113" => "[email protected]" }
+ end
+ let(:pledges) { { "111111" => "100", "111112" => "500" } }
+ let(:rewards) do
+ {
+ "0" => {
+ title: "All Patrons",
+ amount_cents: "0",
+ },
+ "4589" => {
+ title: "Sponsers",
+ amount_cents: "1000",
+ },
+ }
+ end
+ let(:reward_users) { { "0" => %w[111111 111112], "4589" => ["111112"] } }
+ let(:titles) { { "111111" => "All Patrons", "111112" => "All Patrons, Sponsers" } }
+
+ before do
+ Patreon.set("users", patrons)
+ Patreon.set("pledges", pledges)
+ Patreon.set("rewards", rewards)
+ Patreon.set("reward-users", reward_users)
+ end
+
+ it "should find local users matching Patreon user info" do
+ Fabricate(:user, email: "[email protected]")
+ Fabricate(:patreon_user_info, provider_uid: "111112")
+
+ local_users = described_class.get_local_users
+ expect(local_users.count).to eq(2)
+
+ local_users.each do |user_id, patreon_id|
+ user = User.find(user_id)
+ expect(described_class.attr("email", user)).to eq(patrons[patreon_id])
+ expect(described_class.attr("amount_cents", user)).to eq(pledges[patreon_id])
+ expect(described_class.attr("rewards", user)).to eq(titles[patreon_id])
+ end
+ end
+
+ it "should find local users matching email address without case-sensitivity" do
+ patrons["111111"] = "[email protected]"
+ Patreon.set("users", patrons)
+ Fabricate(:user, email: "[email protected]")
+
+ local_users = described_class.get_local_users
+ expect(local_users.count).to eq(1)
+ end
+
+ describe "sync groups" do
+ let(:ouser) { Fabricate(:patreon_user_info, provider_uid: "111112") }
+ let(:group1) { Fabricate(:group) }
+ let(:group2) { Fabricate(:group) }
+
+ before do
+ filters = { group1.id.to_s => ["0"], group2.id.to_s => ["4589"] }
+ Patreon.set("filters", filters)
+ end
+
+ it "should sync all Patreon users" do
+ user = Fabricate(:user, email: "[email protected]")
+ described_class.sync_groups
+ expect(group1.users.to_a - [ouser.user, user]).to eq([])
+ expect(group2.users.to_a - [ouser.user]).to eq([])
+ end
+
+ it "should sync by Patreon id" do
+ described_class.sync_groups_by(patreon_id: ouser.provider_uid)
+ expect(group1.users.to_a).to eq([ouser.user])
+ expect(group2.users.to_a).to eq([ouser.user])
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/spec/lib/seed_spec.rb b/plugins/discourse-patreon/spec/lib/seed_spec.rb
new file mode 100644
index 00000000000..74593b1b7bc
--- /dev/null
+++ b/plugins/discourse-patreon/spec/lib/seed_spec.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+
+RSpec.describe ::Patreon::Seed do
+ it "should seed contents correctly" do
+ described_class.seed_content!
+ group = Group.last
+ expect(group.name).to eq("patrons")
+ expect(group.flair_upload).to be_present
+ expect(Badge.last.name).to eq("Patron")
+ expect(::Patreon.get("filters")).to eq(group.id.to_s => ["0"])
+ end
+
+ it "should not raise error if group already exists" do
+ group = Fabricate(:group, name: "patrons")
+ described_class.seed_content!
+ expect(::Patreon.get("filters")).to eq(group.id.to_s => ["0"])
+ end
+
+ it "should not raise error if badge already exists" do
+ Fabricate(:badge, name: "Patron")
+ described_class.seed_content!
+ end
+end
diff --git a/plugins/discourse-patreon/spec/requests/patreon_admin_controller_spec.rb b/plugins/discourse-patreon/spec/requests/patreon_admin_controller_spec.rb
new file mode 100644
index 00000000000..7186f6d9b29
--- /dev/null
+++ b/plugins/discourse-patreon/spec/requests/patreon_admin_controller_spec.rb
@@ -0,0 +1,65 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+
+describe Patreon::PatreonAdminController do
+ describe "#list" do
+ let(:group1) { Fabricate(:group) }
+ let(:group2) { Fabricate(:group) }
+ let(:admin) { Fabricate(:admin) }
+ let(:filters) { { group1.id.to_s => ["0"], group2.id.to_s => ["208"], "777" => ["888"] } }
+ let(:rewards) { { "1": { sample: "reward" }, "2": { another: "one" } } }
+
+ before do
+ sign_in(admin)
+ SiteSetting.patreon_enabled = true
+ SiteSetting.patreon_creator_access_token = "TOKEN"
+ SiteSetting.patreon_creator_refresh_token = "TOKEN"
+ Patreon.set("filters", filters)
+ Patreon.set("rewards", rewards)
+ end
+
+ it "should display list of patreon groups" do
+ get "/patreon/list.json"
+
+ result = JSON.parse(response.body)
+ expect(result["filters"].count).to eq(2)
+ expect(result["rewards"].count).to eq(2)
+ end
+
+ it "should display list of rewards" do
+ get "/patreon/rewards.json"
+
+ rewards = JSON.parse(response.body)
+ expect(rewards.count).to eq(2)
+ end
+
+ it "should update existing filter" do
+ ids = %w[1 2]
+
+ post "/patreon/list.json", params: { rewards_ids: ids, group_id: group1.id }
+
+ expect(Patreon.get("filters")[group1.id.to_s]).to eq(ids)
+ end
+
+ it "should delete an filter" do
+ expect { delete "/patreon/list.json", params: { group_id: group1.id } }.to change {
+ Patreon.get("filters").count
+ }.by(-1)
+ expect(Patreon.get("filters")[group1.id.to_s]).to eq(nil)
+ end
+
+ it "should sync patreon groups" do
+ Patreon::Patron.expects(:sync_groups)
+ post "/patreon/sync_groups.json"
+ end
+
+ it "should enqueue job to sync patrons and groups" do
+ expect_enqueued_with(job: :patreon_sync_patrons_to_groups) do
+ post "/patreon/update_data.json"
+ end
+
+ expect(response.status).to eq(200)
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/spec/requests/patreon_webhook_controller_spec.rb b/plugins/discourse-patreon/spec/requests/patreon_webhook_controller_spec.rb
new file mode 100644
index 00000000000..9373acd90ec
--- /dev/null
+++ b/plugins/discourse-patreon/spec/requests/patreon_webhook_controller_spec.rb
@@ -0,0 +1,140 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+require "openssl"
+require "json"
+require_relative "../spec_helper"
+
+RSpec.describe ::Patreon::PatreonWebhookController do
+ before do
+ SiteSetting.patreon_enabled = true
+ SiteSetting.login_required = true
+ Jobs.run_immediately!
+ end
+
+ describe "index" do
+ describe "header checking" do
+ it "returns a 403 error without header params" do
+ expect_not_enqueued_with(job: :patreon_sync_patrons_to_groups) { post "/patreon/webhook" }
+
+ expect(response.status).to eq(403)
+ expect(response.parsed_body["errors"]).to contain_exactly("Missing event header")
+ end
+
+ it "returns a 403 error with unknown event" do
+ expect_not_enqueued_with(job: :patreon_sync_patrons_to_groups) do
+ post "/patreon/webhook",
+ headers: {
+ "X-Patreon-Event": "foo:bar",
+ "X-Patreon-Signature": "foo",
+ }
+ end
+
+ expect(response.status).to eq(403)
+ expect(response.parsed_body["errors"]).to contain_exactly("Unknown event: foo:bar")
+ end
+
+ it "returns a 403 error with invalid signature" do
+ expect_not_enqueued_with(job: :patreon_sync_patrons_to_groups) do
+ post "/patreon/webhook",
+ headers: {
+ "X-Patreon-Event": "pledges:create",
+ "X-Patreon-Signature": "foo",
+ }
+ end
+
+ expect(response.status).to eq(403)
+ expect(response.parsed_body["errors"]).to contain_exactly("Invalid signature")
+ end
+ end
+
+ describe "enqueue job" do
+ let(:body) { get_patreon_response("pledge.json") }
+ let(:digest) { OpenSSL::Digest.new("MD5") }
+ let(:secret) { SiteSetting.patreon_webhook_secret = "WEBHOOK SECRET" }
+
+ before do
+ Patreon.set(
+ "rewards",
+ "0": {
+ title: "All Patrons",
+ amount_cents: 0,
+ },
+ "999999": {
+ title: "Premium",
+ amount_cents: 1000,
+ },
+ )
+ end
+
+ def add_pledge
+ pledge_data = JSON.parse(body)
+ Patreon::Pledge.create!(pledge_data.dup)
+
+ pledge_data
+ end
+
+ def post_request(body, event, type = "pledges")
+ post "/patreon/webhook",
+ params: body,
+ headers: {
+ "X-Patreon-Event": "#{type}:#{event}",
+ "X-Patreon-Signature": OpenSSL::HMAC.hexdigest(digest, secret, body),
+ }
+ end
+
+ it "for event pledge:create" do
+ user = Fabricate(:user, email: "[email protected]")
+ group = Fabricate(:group)
+ Patreon.set("filters", group.id.to_s => ["0"])
+
+ expect { post_request(body, "create") }.to change { Patreon::Pledge.all.keys.count }.by(
+ 1,
+ ).and change { Patreon::Patron.all.keys.count }.by(1).and change {
+ Patreon::RewardUser.all.keys.count
+ }.by(2)
+
+ expect(group.users).to include(user)
+ end
+
+ it "for event members:pledge:create" do
+ body = get_patreon_response("member.json")
+ user = Fabricate(:user, email: "[email protected]")
+ group = Fabricate(:group)
+ Patreon.set("filters", group.id.to_s => ["0"])
+
+ expect { post_request(body, "create", "members:pledge") }.to change {
+ Patreon::Pledge.all.keys.count
+ }.by(1).and change { Patreon::Patron.all.keys.count }.by(1).and change {
+ Patreon::RewardUser.all.keys.count
+ }.by(2)
+
+ expect(group.users).to include(user)
+ end
+
+ it "for event pledge:update" do
+ pledge_data = add_pledge
+ pledge = pledge_data["data"]
+ pledge["attributes"]["amount_cents"] = 987
+ patron_id = pledge["relationships"]["patron"]["data"]["id"]
+ pledge_data = JSON.pretty_generate(pledge_data)
+
+ expect(Patreon.get("pledges")[patron_id]).to eq(250)
+ post_request(pledge_data, "update")
+ expect(Patreon.get("pledges")[patron_id]).to eq(987)
+ end
+
+ it "for event pledge:delete" do
+ pledge_data = add_pledge
+ patron_id = pledge_data["data"]["relationships"]["patron"]["data"]["id"]
+ reward_id = pledge_data["data"]["relationships"]["reward"]["data"]["id"]
+
+ expect { post_request(body, "delete") }.to change { Patreon::Pledge.all.keys.count }.by(
+ -1,
+ ).and change { Patreon::Patron.all.keys.count }.by(-1).and change {
+ Patreon::RewardUser.all[reward_id].count
+ }.by(-1)
+ end
+ end
+ end
+end
diff --git a/plugins/discourse-patreon/spec/spec_helper.rb b/plugins/discourse-patreon/spec/spec_helper.rb
new file mode 100644
index 00000000000..c5c469b0dd2
--- /dev/null
+++ b/plugins/discourse-patreon/spec/spec_helper.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module Helpers
+ def get_patreon_response(filename)
+ FileUtils.mkdir_p("#{Rails.root}/tmp/spec") unless Dir.exist?("#{Rails.root}/tmp/spec")
+ FileUtils.cp(
+ "#{Rails.root}/plugins/discourse-patreon/spec/fixtures/#{filename}",
+ "#{Rails.root}/tmp/spec/#{filename}",
+ )
+ File.new("#{Rails.root}/tmp/spec/#{filename}").read
+ end
+end
+
+RSpec.configure { |config| config.include Helpers }
diff --git a/plugins/discourse-patreon/spec/system/core_features_spec.rb b/plugins/discourse-patreon/spec/system/core_features_spec.rb
new file mode 100644
index 00000000000..db86db283bd
--- /dev/null
+++ b/plugins/discourse-patreon/spec/system/core_features_spec.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+RSpec.describe "Core features", type: :system do
+ before { enable_current_plugin }
+
+ it_behaves_like "having working core features"
+end
diff --git a/plugins/discourse-patreon/svg-icons/sprite.svg b/plugins/discourse-patreon/svg-icons/sprite.svg
new file mode 100644
index 00000000000..dfd62a8b578
--- /dev/null
+++ b/plugins/discourse-patreon/svg-icons/sprite.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+ <symbol id="patreon-new" viewBox="0 0 1080 1080">
+ <path d="M1033.05,324.45c-0.19-137.9-107.59-250.92-233.6-291.7c-156.48-50.64-362.86-43.3-512.28,27.2
+ C106.07,145.41,49.18,332.61,47.06,519.31c-1.74,153.5,13.58,557.79,241.62,560.67c169.44,2.15,194.67-216.18,273.07-321.33
+ c55.78-74.81,127.6-95.94,216.01-117.82C929.71,603.22,1033.27,483.3,1033.05,324.45z"/>
+ </symbol>
+</svg>
diff --git a/translator.yml b/translator.yml
index 4da67d79b7e..b8aa9e20e0e 100644
--- a/translator.yml
+++ b/translator.yml
@@ -164,3 +164,10 @@ files:
- source_path: plugins/discourse-zendesk-plugin/config/locales/server.en.yml
destination_path: plugins/zendesk-plugin/server.yml
label: zendesk-plugin
+
+ - source_path: plugins/discourse-patreon/config/locales/client.en.yml
+ destination_path: plugins/patreon/client.yml
+ label: patreon
+ - source_path: plugins/discourse-patreon/config/locales/server.en.yml
+ destination_path: plugins/patreon/server.yml
+ label: patreon