thecore_backend_commons 3.3.3 → 3.4.1

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: de155211a56c3dd33ac67afa1364317e0f369cd042ab4a525a635e9894f58cf8
4
- data.tar.gz: 330b0d329df7f91925d7d46eb5d080f726d579bb30faadb49b319e0baad8cf7e
3
+ metadata.gz: 47f357e5a5b355623f7eaa5443e8ba8cfb5566311f6c5f866cbda9740a48a044
4
+ data.tar.gz: 52725ea116ba712bc9c68b4c3b757c2a64a7b1270b2efd1f56cd16c503d21bbe
5
5
  SHA512:
6
- metadata.gz: '091c036504d51abf95c705a3fa5480aa0b33ffb4429dd0d27cfffaf56b7b1658d46ddf18720d9cd1b3ae7f3ea83650cc950097a616c0ee74fd7a88f3a4c43a01'
7
- data.tar.gz: dc9edc2244eb78a9bcfc2d944cdeca0cdf1e55a35bb1def3707c84975c3d8ebd933bd448e7441dc4978f3d26022ce7d645600fff51b2f789713a89f7fedd80eb
6
+ metadata.gz: fbb02e11840fdd2608ce289285424c5792e50ce09ef207c08a4aafd943761e01f2ed72e50bbe855c0fb8d35e61bb6e24c0ee170d335d26f19f8645b00b918d1e
7
+ data.tar.gz: cfbcd1ecdfb625c4eaa3119a64394afb73806f5c764b3c7982a44432aee24143de465ec268a60ed927714abf0702190e751401377d703dbe4226cc4bd49ac2b8
@@ -0,0 +1,10 @@
1
+ class PushDispatchJob < ApplicationJob
2
+ queue_as :"#{ENV.fetch('COMPOSE_PROJECT_NAME', 'default')}_default"
3
+
4
+ def perform(push_message_id)
5
+ message = PushMessage.find_by(id: push_message_id)
6
+ return unless message
7
+
8
+ ThecoreBackendCommons::PushNotificationService.dispatch(message.push_subscriber, message)
9
+ end
10
+ end
@@ -7,5 +7,7 @@ Rails.application.configure do
7
7
  ApplicationRecord.subclasses.each do |d|
8
8
  d.send(:include, BaseApplicationRecordConcern) unless d.name.start_with?("ActiveStorage::", "ActionText::")
9
9
  end
10
+
11
+ User.send(:include, ThecoreBackendCommonsUserConcern)
10
12
  end
11
13
  end
@@ -0,0 +1,14 @@
1
+ # config.to_prepare do
2
+ # User.class_eval do
3
+ # has_many :push_subscribers, dependent: :destroy
4
+ # end
5
+ # end
6
+
7
+ module ThecoreBackendCommonsUserConcern
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ has_many :push_subscribers, dependent: :destroy
12
+ has_many :sent_push_messages, class_name: "PushMessage", foreign_key: :sender_user_id, dependent: :destroy
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module ThecoreBackendCommons
2
- VERSION = "3.3.3".freeze
2
+ VERSION = "3.4.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_backend_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.3
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
@@ -203,6 +203,7 @@ files:
203
203
  - Rakefile
204
204
  - app/channels/activity_log_channel.rb
205
205
  - app/channels/push_notification_channel.rb
206
+ - app/jobs/push_dispatch_job.rb
206
207
  - app/mailers/concerns/smtp_deliverable.rb
207
208
  - app/models/push_message.rb
208
209
  - app/models/push_subscriber.rb
@@ -214,6 +215,7 @@ files:
214
215
  - config/initializers/concern_cable_connection.rb
215
216
  - config/initializers/concern_integer.rb
216
217
  - config/initializers/concern_string.rb
218
+ - config/initializers/concern_user.rb
217
219
  - config/initializers/extension_nil.rb
218
220
  - config/initializers/extension_string.rb
219
221
  - config/locales/en.devise.custom.yml