discourse_subscription_client 0.1.0.pre2 → 0.1.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/jobs/regular/{discourse_subscription_client/find_resources.rb → discourse_subscription_client_find_resources.rb} +1 -1
- data/app/jobs/scheduled/{discourse_subscription_client/update_notices.rb → discourse_subscription_client_update_notices.rb} +1 -1
- data/app/jobs/scheduled/{discourse_subscription_client/update_subscriptions.rb → discourse_subscription_client_update_subscriptions.rb} +1 -1
- data/app/models/subscription_client_notice.rb +1 -2
- data/app/models/subscription_client_supplier.rb +1 -1
- data/db/migrate/{20220318160955_create_subscription_client_suppliers.rb → 20230221100514_create_subscription_client_suppliers.rb} +2 -2
- data/db/migrate/{20220318181029_create_subscription_client_resources.rb → 20230221100524_create_subscription_client_resources.rb} +2 -2
- data/db/migrate/{20220318181054_create_subscription_client_notices.rb → 20230221100529_create_subscription_client_notices.rb} +2 -2
- data/db/migrate/{20220318181140_create_subscription_client_subscriptions.rb → 20230221100535_create_subscription_client_subscriptions.rb} +3 -2
- data/db/migrate/{20230220130259_create_subscription_client_requests.rb → 20230221100540_create_subscription_client_requests.rb} +0 -0
- data/lib/discourse_subscription_client/engine.rb +5 -5
- data/lib/discourse_subscription_client/version.rb +1 -1
- metadata +38 -11
- data/Rakefile +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 307c93dedfd3a85110f7ad12a1d7e6e91bb1aecaaffc7e6025fec54905aa0df7
|
4
|
+
data.tar.gz: 11dd2c79ba1d825028cc32d2fabc31b0d889be2cb4d2f3c1ad1664c23025dad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f22185915974d1abbc65ae2b0ed1b14022eb14ebdf7a9f8d12e03b3a00968d93ec69d39c25ad286149d95cec29e8e5035b4c52f38fbd362720664970f0044472
|
7
|
+
data.tar.gz: 6f47325b66b776ac2485989006b7d63f3d6e389f5cf0c53b5c4eb8914d8cb16481dcc05d46eeecada45a9ecd620ca70bd64ea2f502af0d3fcfe09a1760c5cc4e
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Jobs
|
4
|
-
class
|
4
|
+
class DiscourseSubscriptionClientFindResources < ::Jobs::Base
|
5
5
|
def execute(_args = {})
|
6
6
|
::DiscourseSubscriptionClient::Resources.find_all unless Rails.env.test?
|
7
7
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class SubscriptionClientNotice < ActiveRecord::Base
|
4
|
-
belongs_to :notice_subject, polymorphic: true
|
5
|
-
delegate :name, to: :subject
|
4
|
+
belongs_to :notice_subject, polymorphic: true, optional: true
|
6
5
|
|
7
6
|
scope :warnings, -> { where(notice_type: SubscriptionClientNotice.types[:warning]) }
|
8
7
|
scope :hidden, -> { where("hidden_at IS NOT NULL AND dismissed_at IS NULL AND expired_at IS NULL") }
|
@@ -5,7 +5,7 @@ class SubscriptionClientSupplier < ActiveRecord::Base
|
|
5
5
|
has_many :subscriptions, through: :resources
|
6
6
|
has_many :notices, class_name: "SubscriptionClientNotice", as: :notice_subject, dependent: :destroy
|
7
7
|
|
8
|
-
belongs_to :user
|
8
|
+
belongs_to :user, optional: true
|
9
9
|
|
10
10
|
scope :authorized, -> { where("api_key IS NOT NULL") }
|
11
11
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class CreateSubscriptionClientSuppliers < ActiveRecord::Migration[
|
3
|
+
class CreateSubscriptionClientSuppliers < ActiveRecord::Migration[7.0]
|
4
4
|
def change
|
5
5
|
create_table :subscription_client_suppliers do |t|
|
6
6
|
t.string :name
|
@@ -12,6 +12,6 @@ class CreateSubscriptionClientSuppliers < ActiveRecord::Migration[6.1]
|
|
12
12
|
t.timestamps
|
13
13
|
end
|
14
14
|
|
15
|
-
add_index :subscription_client_suppliers, [:url], unique: true
|
15
|
+
add_index :subscription_client_suppliers, [:url], unique: true, if_not_exists: true
|
16
16
|
end
|
17
17
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class CreateSubscriptionClientResources < ActiveRecord::Migration[
|
3
|
+
class CreateSubscriptionClientResources < ActiveRecord::Migration[7.0]
|
4
4
|
def change
|
5
5
|
create_table :subscription_client_resources do |t|
|
6
6
|
t.references :supplier, foreign_key: { to_table: :subscription_client_suppliers }
|
@@ -9,6 +9,6 @@ class CreateSubscriptionClientResources < ActiveRecord::Migration[6.1]
|
|
9
9
|
t.timestamps
|
10
10
|
end
|
11
11
|
|
12
|
-
add_index :subscription_client_resources, %i[supplier_id name], unique: true
|
12
|
+
add_index :subscription_client_resources, %i[supplier_id name], unique: true, if_not_exists: true
|
13
13
|
end
|
14
14
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class CreateSubscriptionClientNotices < ActiveRecord::Migration[
|
3
|
+
class CreateSubscriptionClientNotices < ActiveRecord::Migration[7.0]
|
4
4
|
def change
|
5
5
|
create_table :subscription_client_notices do |t|
|
6
6
|
t.string :title, null: false
|
@@ -17,6 +17,6 @@ class CreateSubscriptionClientNotices < ActiveRecord::Migration[6.1]
|
|
17
17
|
end
|
18
18
|
|
19
19
|
add_index :subscription_client_notices, %i[notice_type notice_subject_type notice_subject_id changed_at],
|
20
|
-
unique: true, name: "sc_unique_notices"
|
20
|
+
unique: true, name: "sc_unique_notices", if_not_exists: true
|
21
21
|
end
|
22
22
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class CreateSubscriptionClientSubscriptions < ActiveRecord::Migration[
|
3
|
+
class CreateSubscriptionClientSubscriptions < ActiveRecord::Migration[7.0]
|
4
4
|
def change
|
5
5
|
create_table :subscription_client_subscriptions do |t|
|
6
6
|
t.references :resource, foreign_key: { to_table: :subscription_client_resources }
|
@@ -14,6 +14,7 @@ class CreateSubscriptionClientSubscriptions < ActiveRecord::Migration[6.1]
|
|
14
14
|
end
|
15
15
|
|
16
16
|
add_index :subscription_client_subscriptions, %i[resource_id product_id price_id], unique: true,
|
17
|
-
name: "sc_unique_subscriptions"
|
17
|
+
name: "sc_unique_subscriptions",
|
18
|
+
if_not_exists: true
|
18
19
|
end
|
19
20
|
end
|
File without changes
|
@@ -14,7 +14,7 @@ module DiscourseSubscriptionClient
|
|
14
14
|
config.after_initialize do
|
15
15
|
gem_root = File.expand_path("../..", __dir__)
|
16
16
|
|
17
|
-
ActiveRecord::Tasks::DatabaseTasks.migrations_paths << "#{gem_root}/db/migrate"
|
17
|
+
ActiveRecord::Tasks::DatabaseTasks.migrations_paths << "#{gem_root}/db/migrate" unless Rails.env.test?
|
18
18
|
|
19
19
|
%w[
|
20
20
|
./request
|
@@ -35,16 +35,16 @@ module DiscourseSubscriptionClient
|
|
35
35
|
../../app/serializers/discourse_subscription_client/resource_serializer
|
36
36
|
../../app/serializers/discourse_subscription_client/notice_serializer
|
37
37
|
../../app/serializers/discourse_subscription_client/subscription_serializer
|
38
|
-
../../app/jobs/regular/
|
39
|
-
../../app/jobs/scheduled/
|
40
|
-
../../app/jobs/scheduled/
|
38
|
+
../../app/jobs/regular/discourse_subscription_client_find_resources
|
39
|
+
../../app/jobs/scheduled/discourse_subscription_client_update_subscriptions
|
40
|
+
../../app/jobs/scheduled/discourse_subscription_client_update_notices
|
41
41
|
../../extensions/discourse_subscription_client/current_user
|
42
42
|
../../extensions/discourse_subscription_client/guardian
|
43
43
|
].each do |path|
|
44
44
|
require_relative path
|
45
45
|
end
|
46
46
|
|
47
|
-
Jobs.enqueue(:
|
47
|
+
Jobs.enqueue(:discourse_subscription_client_find_resources) if DiscourseSubscriptionClient.database_exists? && !Rails.env.test?
|
48
48
|
|
49
49
|
Rails.application.routes.append do
|
50
50
|
mount DiscourseSubscriptionClient::Engine, at: "/admin/plugins/subscription-client"
|
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.
|
4
|
+
version: 0.1.0.pre4
|
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-
|
11
|
+
date: 2023-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pg
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rails
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +178,20 @@ dependencies:
|
|
164
178
|
- - ">="
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: sprockets-rails
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
167
195
|
- !ruby/object:Gem::Dependency
|
168
196
|
name: webmock
|
169
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,16 +216,15 @@ files:
|
|
188
216
|
- COPYRIGHT.txt
|
189
217
|
- LICENSE.txt
|
190
218
|
- README.md
|
191
|
-
- Rakefile
|
192
219
|
- app/assets/config/discourse_subscription_client_manifest.js
|
193
220
|
- app/assets/stylesheets/discourse_subscription_client/application.css
|
194
221
|
- app/controllers/discourse_subscription_client/admin_controller.rb
|
195
222
|
- app/controllers/discourse_subscription_client/notices_controller.rb
|
196
223
|
- app/controllers/discourse_subscription_client/subscriptions_controller.rb
|
197
224
|
- app/controllers/discourse_subscription_client/suppliers_controller.rb
|
198
|
-
- app/jobs/regular/
|
199
|
-
- app/jobs/scheduled/
|
200
|
-
- app/jobs/scheduled/
|
225
|
+
- app/jobs/regular/discourse_subscription_client_find_resources.rb
|
226
|
+
- app/jobs/scheduled/discourse_subscription_client_update_notices.rb
|
227
|
+
- app/jobs/scheduled/discourse_subscription_client_update_subscriptions.rb
|
201
228
|
- app/models/subscription_client_notice.rb
|
202
229
|
- app/models/subscription_client_request.rb
|
203
230
|
- app/models/subscription_client_resource.rb
|
@@ -210,11 +237,11 @@ files:
|
|
210
237
|
- config/locales/server.en.yml
|
211
238
|
- config/routes.rb
|
212
239
|
- config/settings.yml
|
213
|
-
- db/migrate/
|
214
|
-
- db/migrate/
|
215
|
-
- db/migrate/
|
216
|
-
- db/migrate/
|
217
|
-
- db/migrate/
|
240
|
+
- db/migrate/20230221100514_create_subscription_client_suppliers.rb
|
241
|
+
- db/migrate/20230221100524_create_subscription_client_resources.rb
|
242
|
+
- db/migrate/20230221100529_create_subscription_client_notices.rb
|
243
|
+
- db/migrate/20230221100535_create_subscription_client_subscriptions.rb
|
244
|
+
- db/migrate/20230221100540_create_subscription_client_requests.rb
|
218
245
|
- extensions/discourse_subscription_client/current_user.rb
|
219
246
|
- extensions/discourse_subscription_client/guardian.rb
|
220
247
|
- lib/discourse_subscription_client.rb
|
data/Rakefile
DELETED