DEV: Update linting (#189)
This commit is contained in:
parent
a3883d2a9a
commit
d33cf2921e
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"globals": {
|
||||
"Stripe": true
|
||||
},
|
||||
"extends": "eslint-config-discourse"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
module.exports = require("@discourse/lint-configs/eslint");
|
|
@ -1 +0,0 @@
|
|||
{}
|
|
@ -0,0 +1 @@
|
|||
module.exports = require("@discourse/lint-configs/prettier");
|
|
@ -0,0 +1 @@
|
|||
module.exports = require("@discourse/lint-configs/template-lint");
|
|
@ -1,4 +0,0 @@
|
|||
module.exports = {
|
||||
plugins: ["ember-template-lint-plugin-discourse"],
|
||||
extends: "discourse:recommended",
|
||||
};
|
52
Gemfile.lock
52
Gemfile.lock
|
@ -8,35 +8,45 @@ GEM
|
|||
remote: https://rubygems.org/
|
||||
specs:
|
||||
ast (2.4.2)
|
||||
json (2.6.2)
|
||||
parallel (1.22.1)
|
||||
parser (3.1.2.1)
|
||||
json (2.7.1)
|
||||
language_server-protocol (3.17.0.3)
|
||||
parallel (1.24.0)
|
||||
parser (3.3.0.4)
|
||||
ast (~> 2.4.1)
|
||||
prettier_print (1.2.0)
|
||||
racc
|
||||
prettier_print (1.2.1)
|
||||
racc (1.7.3)
|
||||
rainbow (3.1.1)
|
||||
regexp_parser (2.6.0)
|
||||
rexml (3.2.5)
|
||||
rubocop (1.36.0)
|
||||
regexp_parser (2.9.0)
|
||||
rexml (3.2.6)
|
||||
rubocop (1.60.0)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (>= 3.17.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.1.2.1)
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.20.1, < 2.0)
|
||||
rubocop-ast (>= 1.30.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.21.0)
|
||||
parser (>= 3.1.1.0)
|
||||
rubocop-discourse (3.0)
|
||||
rubocop (>= 1.1.0)
|
||||
rubocop-rspec (>= 2.0.0)
|
||||
rubocop-rspec (2.13.2)
|
||||
rubocop (~> 1.33)
|
||||
ruby-progressbar (1.11.0)
|
||||
syntax_tree (5.1.0)
|
||||
unicode-display_width (>= 2.4.0, < 3.0)
|
||||
rubocop-ast (1.30.0)
|
||||
parser (>= 3.2.1.0)
|
||||
rubocop-capybara (2.20.0)
|
||||
rubocop (~> 1.41)
|
||||
rubocop-discourse (3.6.0)
|
||||
rubocop (>= 1.59.0)
|
||||
rubocop-rspec (>= 2.25.0)
|
||||
rubocop-factory_bot (2.25.1)
|
||||
rubocop (~> 1.41)
|
||||
rubocop-rspec (2.26.1)
|
||||
rubocop (~> 1.40)
|
||||
rubocop-capybara (~> 2.17)
|
||||
rubocop-factory_bot (~> 2.22)
|
||||
ruby-progressbar (1.13.0)
|
||||
syntax_tree (6.2.0)
|
||||
prettier_print (>= 1.2.0)
|
||||
unicode-display_width (2.3.0)
|
||||
unicode-display_width (2.5.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
@ -47,4 +57,4 @@ DEPENDENCIES
|
|||
translations-manager!
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.4
|
||||
2.5.4
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { action } from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { equal } from "@ember/object/computed";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import Component from "@ember/component";
|
||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
||||
import { action } from "@ember/object";
|
||||
import { equal } from "@ember/object/computed";
|
||||
import { later } from "@ember/runloop";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
||||
|
||||
const SIDEBAR_BODY_CLASS = "subscription-campaign-sidebar";
|
||||
|
||||
|
@ -96,6 +96,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
document.body.classList.remove(SIDEBAR_BODY_CLASS);
|
||||
},
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import Component from "@glimmer/component";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { Input } from "@ember/component";
|
||||
import { fn, hash } from "@ember/helper";
|
||||
import DButton from "discourse/components/d-button";
|
||||
import DModal from "discourse/components/d-modal";
|
||||
import Component from "@glimmer/component";
|
||||
import { fn, hash } from "@ember/helper";
|
||||
import i18n from "discourse-common/helpers/i18n";
|
||||
import { Input } from "@ember/component";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
|
||||
export default class AdminCancelSubscription extends Component {
|
||||
@tracked refund;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import Component from "@ember/component";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["product-list"],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import ComboBoxComponent from "select-kit/components/combo-box";
|
||||
import { computed } from "@ember/object";
|
||||
import I18n from "I18n";
|
||||
import ComboBoxComponent from "select-kit/components/combo-box";
|
||||
|
||||
export default ComboBoxComponent.extend({
|
||||
pluginApiIdentifiers: ["subscribe-ca-province-select"],
|
||||
|
|
|
@ -24,5 +24,8 @@ export default Component.extend({
|
|||
},
|
||||
});
|
||||
},
|
||||
didDestroyElement() {},
|
||||
|
||||
didDestroyElement() {
|
||||
this._super(...arguments);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import ComboBoxComponent from "select-kit/components/combo-box";
|
||||
import { computed } from "@ember/object";
|
||||
import I18n from "I18n";
|
||||
import ComboBoxComponent from "select-kit/components/combo-box";
|
||||
|
||||
export default ComboBoxComponent.extend({
|
||||
pluginApiIdentifiers: ["subscribe-country-select"],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import ComboBoxComponent from "select-kit/components/combo-box";
|
||||
import { computed } from "@ember/object";
|
||||
import I18n from "I18n";
|
||||
import ComboBoxComponent from "select-kit/components/combo-box";
|
||||
|
||||
export default ComboBoxComponent.extend({
|
||||
pluginApiIdentifiers: ["subscribe-us-state-select"],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Controller from "@ember/controller";
|
||||
import AdminCoupon from "discourse/plugins/discourse-subscriptions/discourse/models/admin-coupon";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import AdminCoupon from "discourse/plugins/discourse-subscriptions/discourse/models/admin-coupon";
|
||||
|
||||
export default Controller.extend({
|
||||
creating: null,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Controller from "@ember/controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default Controller.extend({
|
||||
router: service(),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import Controller from "@ember/controller";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
const RECURRING = "recurring";
|
||||
const ONE_TIME = "one_time";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import Controller from "@ember/controller";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default Controller.extend({
|
||||
router: service(),
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import AdminCancelSubscription from "../components/modal/admin-cancel-subscription";
|
||||
import AdminSubscription from "../models/admin-subscription";
|
||||
import Controller from "@ember/controller";
|
||||
import { action } from "@ember/object";
|
||||
import { inject as service } from "@ember/service";
|
||||
import I18n from "discourse-i18n";
|
||||
import AdminCancelSubscription from "../components/modal/admin-cancel-subscription";
|
||||
import AdminSubscription from "../models/admin-subscription";
|
||||
|
||||
export default Controller.extend({
|
||||
modal: service(),
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { action } from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import Controller from "@ember/controller";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import I18n from "I18n";
|
||||
import { action } from "@ember/object";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import I18n from "I18n";
|
||||
|
||||
export default Controller.extend({
|
||||
loading: false,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Controller from "@ember/controller";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import User from "discourse/models/user";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
@discourseComputed()
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/* global Stripe */
|
||||
import Controller from "@ember/controller";
|
||||
import { not } from "@ember/object/computed";
|
||||
import { inject as service } from "@ember/service";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import I18n from "I18n";
|
||||
import Subscription from "discourse/plugins/discourse-subscriptions/discourse/models/subscription";
|
||||
import Transaction from "discourse/plugins/discourse-subscriptions/discourse/models/transaction";
|
||||
import I18n from "I18n";
|
||||
import { not } from "@ember/object/computed";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default Controller.extend({
|
||||
dialog: service(),
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
/* global Stripe */
|
||||
import Controller from "@ember/controller";
|
||||
import { action } from "@ember/object";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import I18n from "I18n";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default Controller.extend({
|
||||
dialog: service(),
|
||||
|
||||
loading: false,
|
||||
saved: false,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.set(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
|
||||
|
||||
export default function formatUnixDate(timestamp) {
|
||||
if (timestamp) {
|
||||
|
|
|
@ -5,7 +5,7 @@ export default {
|
|||
name: "setup-subscriptions",
|
||||
initialize(container) {
|
||||
withPluginApi("0.8.11", (api) => {
|
||||
const siteSettings = container.lookup("site-settings:main");
|
||||
const siteSettings = container.lookup("service:site-settings");
|
||||
const isNavLinkEnabled =
|
||||
siteSettings.discourse_subscriptions_extra_nav_subscribe;
|
||||
if (isNavLinkEnabled) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ajax } from "discourse/lib/ajax";
|
||||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
const AdminCoupon = EmberObject.extend({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/plan";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/plan";
|
||||
|
||||
const AdminPlan = Plan.extend({
|
||||
isNew: false,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ajax } from "discourse/lib/ajax";
|
||||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
const AdminProduct = EmberObject.extend({
|
||||
isNew: false,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
const AdminSubscription = EmberObject.extend({
|
||||
@discourseComputed("status")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import EmberObject from "@ember/object";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
const Subscription = EmberObject.extend({
|
||||
@discourseComputed("status")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
const UserPayment = EmberObject.extend({
|
||||
@discourseComputed("amount")
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/plan";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import I18n from "I18n";
|
||||
import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/plan";
|
||||
|
||||
const UserSubscription = EmberObject.extend({
|
||||
@discourseComputed("status")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { action } from "@ember/object";
|
||||
import Route from "@ember/routing/route";
|
||||
import AdminCoupon from "discourse/plugins/discourse-subscriptions/discourse/models/admin-coupon";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
export default Route.extend({
|
||||
model() {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import AdminProduct from "discourse/plugins/discourse-subscriptions/discourse/models/admin-product";
|
||||
import I18n from "I18n";
|
||||
import { action } from "@ember/object";
|
||||
import Route from "@ember/routing/route";
|
||||
import { inject as service } from "@ember/service";
|
||||
import I18n from "I18n";
|
||||
import AdminProduct from "discourse/plugins/discourse-subscriptions/discourse/models/admin-product";
|
||||
|
||||
export default Route.extend({
|
||||
dialog: service(),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
||||
import Group from "discourse/models/group";
|
||||
import { hash } from "rsvp";
|
||||
import Group from "discourse/models/group";
|
||||
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
||||
|
||||
export default Route.extend({
|
||||
model(params) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import AdminProduct from "discourse/plugins/discourse-subscriptions/discourse/models/admin-product";
|
||||
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
||||
import I18n from "I18n";
|
||||
import { hash } from "rsvp";
|
||||
import { action } from "@ember/object";
|
||||
import Route from "@ember/routing/route";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { hash } from "rsvp";
|
||||
import I18n from "I18n";
|
||||
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
||||
import AdminProduct from "discourse/plugins/discourse-subscriptions/discourse/models/admin-product";
|
||||
|
||||
export default Route.extend({
|
||||
dialog: service(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import { action } from "@ember/object";
|
||||
import Route from "@ember/routing/route";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default Route.extend({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import Product from "discourse/plugins/discourse-subscriptions/discourse/models/product";
|
||||
import { inject as service } from "@ember/service";
|
||||
import Product from "discourse/plugins/discourse-subscriptions/discourse/models/product";
|
||||
|
||||
export default Route.extend({
|
||||
router: service(),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import Product from "discourse/plugins/discourse-subscriptions/discourse/models/product";
|
||||
import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/plan";
|
||||
import Product from "discourse/plugins/discourse-subscriptions/discourse/models/product";
|
||||
import Subscription from "discourse/plugins/discourse-subscriptions/discourse/models/subscription";
|
||||
|
||||
export default Route.extend({
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import UserSubscription from "discourse/plugins/discourse-subscriptions/discourse/models/user-subscription";
|
||||
import I18n from "I18n";
|
||||
import { action } from "@ember/object";
|
||||
import Route from "@ember/routing/route";
|
||||
import { inject as service } from "@ember/service";
|
||||
import I18n from "I18n";
|
||||
import UserSubscription from "discourse/plugins/discourse-subscriptions/discourse/models/user-subscription";
|
||||
|
||||
export default Route.extend({
|
||||
dialog: service(),
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default Route.extend({
|
||||
router: service(),
|
||||
|
||||
templateName: "user/billing",
|
||||
|
||||
setupController(controller, model) {
|
||||
if (this.currentUser.id !== this.modelFor("user").id) {
|
||||
this.replaceWith("userActivity");
|
||||
this.router.replaceWith("userActivity");
|
||||
} else {
|
||||
controller.setProperties({ model });
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
<DSection
|
||||
@pageClass="user-billing"
|
||||
@class="user-secondary-navigation"
|
||||
@scrollTop="false"
|
||||
>
|
||||
{{body-class "user-billing-page"}}
|
||||
|
||||
<section class="user-secondary-navigation">
|
||||
<MobileNav
|
||||
@class="activity-nav"
|
||||
@desktopClass="action-list nav-stacked"
|
||||
@currentPath={{router._router.currentPath}}
|
||||
class="activity-nav"
|
||||
>
|
||||
<li>
|
||||
<LinkTo @route="user.billing.subscriptions">
|
||||
|
@ -20,7 +18,7 @@
|
|||
</LinkTo>
|
||||
</li>
|
||||
</MobileNav>
|
||||
</DSection>
|
||||
</section>
|
||||
|
||||
<section class="user-content">
|
||||
{{outlet}}
|
||||
|
|
|
@ -90,14 +90,14 @@ def import_subscriptions(procourse_import)
|
|||
product_ids = DiscourseSubscriptions::Product.all.pluck(:external_id)
|
||||
|
||||
all_customers = get_stripe_customers
|
||||
puts "Total available Stripe Customers: #{all_customers.length.to_s}, the first of which is customer id: #{all_customers[0][:description]}"
|
||||
puts "Total available Stripe Customers: #{all_customers.length}, the first of which is customer id: #{all_customers[0][:description]}"
|
||||
|
||||
subscriptions = get_stripe_subscriptions
|
||||
puts "Total Active Subscriptions available: #{subscriptions.length.to_s}"
|
||||
puts "Total Active Subscriptions available: #{subscriptions.length}"
|
||||
|
||||
subscriptions_for_products =
|
||||
subscriptions.select { |sub| product_ids.include?(sub[:items][:data][0][:price][:product]) }
|
||||
puts "Total Subscriptions matching Products to Import: #{subscriptions_for_products.length.to_s}"
|
||||
puts "Total Subscriptions matching Products to Import: #{subscriptions_for_products.length}"
|
||||
|
||||
subscriptions_for_products.each do |subscription|
|
||||
product_id = subscription[:items][:data][0][:plan][:product]
|
||||
|
|
10
package.json
10
package.json
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"name": "discourse-subscriptions",
|
||||
"version": "1.0.0",
|
||||
"repository": "https://github.com/discourse/discourse-subscriptions",
|
||||
"author": "Discourse",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"eslint-config-discourse": "^3.4.0"
|
||||
"@discourse/lint-configs": "^1.3.5",
|
||||
"ember-template-lint": "^5.13.0",
|
||||
"eslint": "^8.56.0",
|
||||
"prettier": "^2.8.8"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
# version: 2.8.1
|
||||
# url: https://github.com/discourse/discourse-subscriptions
|
||||
# authors: Rimian Perkins, Justin DiRose
|
||||
# transpile_js: true
|
||||
|
||||
enabled_site_setting :discourse_subscriptions_enabled
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
module DiscourseSubscriptions
|
||||
RSpec.describe Customer do
|
||||
RSpec.describe DiscourseSubscriptions::Customer do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:stripe_customer) { { id: "cus_id4567" } }
|
||||
|
||||
|
@ -23,4 +22,3 @@ module DiscourseSubscriptions
|
|||
expect(customer.customer_id).to eq "cus_id4567"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,12 +2,9 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
module DiscourseSubscriptions
|
||||
RSpec.describe Admin::CouponsController do
|
||||
RSpec.describe DiscourseSubscriptions::Admin::CouponsController do
|
||||
it "is a subclass of AdminController" do
|
||||
expect(DiscourseSubscriptions::Admin::CouponsController < ::Admin::AdminController).to eq(
|
||||
true,
|
||||
)
|
||||
expect(DiscourseSubscriptions::Admin::CouponsController < ::Admin::AdminController).to eq(true)
|
||||
end
|
||||
|
||||
context "when unauthenticated" do
|
||||
|
@ -86,4 +83,3 @@ module DiscourseSubscriptions
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,13 +2,9 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
module DiscourseSubscriptions
|
||||
module Admin
|
||||
RSpec.describe PlansController do
|
||||
RSpec.describe DiscourseSubscriptions::Admin::PlansController do
|
||||
it "is a subclass of AdminController" do
|
||||
expect(DiscourseSubscriptions::Admin::PlansController < ::Admin::AdminController).to eq(
|
||||
true,
|
||||
)
|
||||
expect(DiscourseSubscriptions::Admin::PlansController < ::Admin::AdminController).to eq(true)
|
||||
end
|
||||
|
||||
context "when not authenticated" do
|
||||
|
@ -170,5 +166,3 @@ module DiscourseSubscriptions
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,13 +2,9 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
module DiscourseSubscriptions
|
||||
module Admin
|
||||
RSpec.describe ProductsController do
|
||||
RSpec.describe DiscourseSubscriptions::Admin::ProductsController do
|
||||
it "is a subclass of AdminController" do
|
||||
expect(DiscourseSubscriptions::Admin::ProductsController < ::Admin::AdminController).to eq(
|
||||
true,
|
||||
)
|
||||
expect(DiscourseSubscriptions::Admin::ProductsController < ::Admin::AdminController).to eq(true)
|
||||
end
|
||||
|
||||
context "when unauthenticated" do
|
||||
|
@ -130,5 +126,3 @@ module DiscourseSubscriptions
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
module DiscourseSubscriptions
|
||||
RSpec.describe Admin::SubscriptionsController do
|
||||
RSpec.describe DiscourseSubscriptions::Admin::SubscriptionsController do
|
||||
it "is a subclass of AdminController" do
|
||||
expect(
|
||||
DiscourseSubscriptions::Admin::SubscriptionsController < ::Admin::AdminController,
|
||||
).to eq(true)
|
||||
expect(DiscourseSubscriptions::Admin::SubscriptionsController < ::Admin::AdminController).to eq(
|
||||
true,
|
||||
)
|
||||
end
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
@ -140,4 +139,3 @@ module DiscourseSubscriptions
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
module DiscourseSubscriptions
|
||||
RSpec.describe AdminController do
|
||||
RSpec.describe DiscourseSubscriptions::AdminController do
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
|
||||
before { sign_in(admin) }
|
||||
|
@ -17,4 +16,3 @@ module DiscourseSubscriptions
|
|||
expect(response.status).to eq(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
module DiscourseSubscriptions
|
||||
RSpec.describe HooksController do
|
||||
RSpec.describe DiscourseSubscriptions::HooksController do
|
||||
before { SiteSetting.discourse_subscriptions_webhook_secret = "zascharoo" }
|
||||
|
||||
it "contructs a webhook event" do
|
||||
it "constructs a webhook event" do
|
||||
payload = "we-want-a-shrubbery"
|
||||
headers = { HTTP_STRIPE_SIGNATURE: "stripe-webhook-signature" }
|
||||
|
||||
|
@ -93,9 +92,7 @@ module DiscourseSubscriptions
|
|||
end
|
||||
|
||||
it "deletes the customer" do
|
||||
expect { post "/s/hooks.json" }.to change { DiscourseSubscriptions::Customer.count }.by(
|
||||
-1,
|
||||
)
|
||||
expect { post "/s/hooks.json" }.to change { DiscourseSubscriptions::Customer.count }.by(-1)
|
||||
|
||||
expect(response.status).to eq 200
|
||||
end
|
||||
|
@ -108,4 +105,3 @@ module DiscourseSubscriptions
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,14 +2,9 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
module DiscourseSubscriptions
|
||||
RSpec.describe SubscribeController do
|
||||
let (:user) {
|
||||
Fabricate(:user)
|
||||
}
|
||||
let (:campaign_user) {
|
||||
Fabricate(:user)
|
||||
}
|
||||
RSpec.describe DiscourseSubscriptions::SubscribeController do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:campaign_user) { Fabricate(:user) }
|
||||
|
||||
context "when showing products" do
|
||||
let(:product) do
|
||||
|
@ -316,10 +311,7 @@ module DiscourseSubscriptions
|
|||
context "with customer name & address" do
|
||||
it "creates a customer & subscription when a customer address is provided" do
|
||||
::Stripe::Price.expects(:retrieve).returns(type: "recurring", metadata: {})
|
||||
::Stripe::Subscription.expects(:create).returns(
|
||||
status: "active",
|
||||
customer: "cus_1234",
|
||||
)
|
||||
::Stripe::Subscription.expects(:create).returns(status: "active", customer: "cus_1234")
|
||||
expect {
|
||||
post "/s/create.json",
|
||||
params: {
|
||||
|
@ -572,4 +564,3 @@ module DiscourseSubscriptions
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
module DiscourseSubscriptions
|
||||
RSpec.describe User::PaymentsController do
|
||||
RSpec.describe DiscourseSubscriptions::User::PaymentsController do
|
||||
it "is a subclass of ApplicationController" do
|
||||
expect(DiscourseSubscriptions::User::PaymentsController < ::ApplicationController).to eq(true)
|
||||
end
|
||||
|
@ -61,4 +60,3 @@ module DiscourseSubscriptions
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
module DiscourseSubscriptions
|
||||
RSpec.describe User::SubscriptionsController do
|
||||
RSpec.describe DiscourseSubscriptions::User::SubscriptionsController do
|
||||
it "is a subclass of ApplicationController" do
|
||||
expect(DiscourseSubscriptions::User::SubscriptionsController < ::ApplicationController).to eq(
|
||||
true,
|
||||
|
@ -104,4 +103,3 @@ module DiscourseSubscriptions
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,6 +11,7 @@ describe SiteSerializer do
|
|||
SiteSetting.discourse_subscriptions_enabled = true
|
||||
SiteSetting.discourse_subscriptions_campaign_enabled = true
|
||||
end
|
||||
|
||||
it "is false if the goal_met date is < 7 days old" do
|
||||
Discourse.redis.set("subscriptions_goal_met_date", 10.days.ago)
|
||||
data = described_class.new(Site.new(guardian), scope: guardian, root: false).as_json
|
||||
|
|
|
@ -4,12 +4,8 @@ require "rails_helper"
|
|||
|
||||
describe DiscourseSubscriptions::Campaign do
|
||||
describe "campaign data is refreshed" do
|
||||
let (:user) {
|
||||
Fabricate(:user)
|
||||
}
|
||||
let (:user2) {
|
||||
Fabricate(:user)
|
||||
}
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:user2) { Fabricate(:user) }
|
||||
let(:subscription) do
|
||||
{
|
||||
id: "sub_1234",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe";
|
||||
import { visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe";
|
||||
|
||||
acceptance("Discourse Subscriptions", function (needs) {
|
||||
needs.user();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe";
|
||||
|
||||
function singleProductPretender() {
|
||||
pretender.get("/s", () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { count, discourseModule } from "discourse/tests/helpers/qunit-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import componentTest, {
|
||||
setupRenderingTest,
|
||||
} from "discourse/tests/helpers/component-test";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { count, discourseModule } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
discourseModule("payment-options", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import hbs from "htmlbars-inline-precompile";
|
||||
import componentTest, {
|
||||
setupRenderingTest,
|
||||
} from "discourse/tests/helpers/component-test";
|
||||
import {
|
||||
count,
|
||||
discourseModule,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import componentTest, {
|
||||
setupRenderingTest,
|
||||
} from "discourse/tests/helpers/component-test";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
|
||||
discourseModule("payment-plan", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
|
Loading…
Reference in New Issue