discourse_subscription_client 0.1.0.pre9 → 0.1.0.pre11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 660696bcefd9a3277aecb58ea84b3b8523fe25f67ce8622537659c3f4e9cb3de
4
- data.tar.gz: b0a5bb0ef2b75129c5b0698b4ea966452db15e70233edf5e171f52ebc2d76ef7
3
+ metadata.gz: 6182382e0517359b04736dd702fc121669e40775a138eaf6bab7493ae722591a
4
+ data.tar.gz: 4554111e5f4b3659cfbf5d1ac70bed551237435e32c5265acf8a8093ca7db5d4
5
5
  SHA512:
6
- metadata.gz: 601eed6e1e0d001609fd9f3f1c9ffc4c5db1dbaea3f892c00542794f1a659739afd32b68b4e70fb603ec25c2c662f32112928617f7f1bcbd8eebba0d68059ab2
7
- data.tar.gz: dfcef63df0719f54187dcdb0530c5f154b6e2750ebe2583b1ea260a8acafb6fc71d982e2512b16b0416780d961556a751e5eac783660c7527f5feac72290b12a
6
+ metadata.gz: 2988268b14449153a71e2345489f8cc97861b1d6562d62901724ba0db2151465a58bc153bffad9d5a516e2218cfd761523a0d95d8ca90a3e0c24351c1f21365b
7
+ data.tar.gz: e7d340f95ce7995c7edb4444987daec675706e056898613a2b7526af5010d5a239249e764d4e7804a0e3c75ac1ae0f16386c03e9c691d72ce0ff0f96bfeb45d1
data/README.md CHANGED
@@ -5,7 +5,7 @@ This gem is only for use with Discourse plugins. It provides subscription client
5
5
  Add this line to your plugin's `plugin.rb` file
6
6
 
7
7
  ```ruby
8
- gem "discourse_subscription_client", "0.1.0.pre5", require_name: "discourse_subscription_client"
8
+ gem "discourse_subscription_client", "0.1.0.pre11", require_name: "discourse_subscription_client"
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DiscourseSubscriptionClient
4
+ class NoAccessController < ApplicationController
5
+ def index
6
+ head :ok
7
+ end
8
+ end
9
+ end
@@ -10,13 +10,9 @@ class SubscriptionClientSupplier < ActiveRecord::Base
10
10
  scope :authorized, -> { where("api_key IS NOT NULL") }
11
11
 
12
12
  def destroy_authorization
13
- if DiscourseSubscriptionClient::Authorization.revoke(self)
14
- update(api_key: nil, user_id: nil, authorized_at: nil)
15
- deactivate_all_subscriptions!
16
- true
17
- else
18
- false
19
- end
13
+ DiscourseSubscriptionClient::Authorization.revoke(self)
14
+ update(api_key: nil, user_id: nil, authorized_at: nil)
15
+ deactivate_all_subscriptions!
20
16
  end
21
17
 
22
18
  def authorized?
@@ -24,8 +20,12 @@ class SubscriptionClientSupplier < ActiveRecord::Base
24
20
  end
25
21
 
26
22
  def product_slugs
27
- @product_slugs ||= products.each_with_object({}) do |product, result|
28
- result[product["product_id"]] = product["product_slug"]
23
+ if products.present?
24
+ products.each_with_object({}) do |product, result|
25
+ result[product["product_id"]] = product["product_slug"]
26
+ end
27
+ else
28
+ {}
29
29
  end
30
30
  end
31
31
 
data/config/routes.rb CHANGED
@@ -17,4 +17,6 @@ DiscourseSubscriptionClient::Engine.routes.draw do
17
17
  put "notices/:notice_id/dismiss" => "notices#dismiss"
18
18
  put "notices/:notice_id/hide" => "notices#hide"
19
19
  put "notices/:notice_id/show" => "notices#show"
20
+
21
+ get "no-access" => "no_access#index"
20
22
  end
@@ -29,6 +29,7 @@ module DiscourseSubscriptionClient
29
29
  ../../app/models/subscription_client_resource
30
30
  ../../app/models/subscription_client_subscription
31
31
  ../../app/models/subscription_client_supplier
32
+ ../../app/controllers/discourse_subscription_client/no_access_controller
32
33
  ../../app/controllers/discourse_subscription_client/admin_controller
33
34
  ../../app/controllers/discourse_subscription_client/subscriptions_controller
34
35
  ../../app/controllers/discourse_subscription_client/suppliers_controller
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiscourseSubscriptionClient
4
- VERSION = "0.1.0.pre9"
4
+ VERSION = "0.1.0.pre11"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discourse_subscription_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre9
4
+ version: 0.1.0.pre11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angus McLeod
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-24 00:00:00.000000000 Z
11
+ date: 2023-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -233,6 +233,7 @@ files:
233
233
  - app/assets/config/discourse_subscription_client_manifest.js
234
234
  - app/assets/stylesheets/discourse_subscription_client/application.css
235
235
  - app/controllers/discourse_subscription_client/admin_controller.rb
236
+ - app/controllers/discourse_subscription_client/no_access_controller.rb
236
237
  - app/controllers/discourse_subscription_client/notices_controller.rb
237
238
  - app/controllers/discourse_subscription_client/subscriptions_controller.rb
238
239
  - app/controllers/discourse_subscription_client/suppliers_controller.rb