noticed 2.0.1 → 2.0.2
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 +4 -4
- data/README.md +2 -2
- data/app/channels/noticed/notification_channel.rb +19 -0
- data/lib/noticed/delivery_methods/action_cable.rb +3 -3
- data/lib/noticed/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2526071997479bc9e570c51d5b148ce569f9afb45912b6c2b1bea71be65fc30e
|
4
|
+
data.tar.gz: ffa64bdc283245497a456f125680a41da2cf0ba7ad52c2c6320af24b5ec3d956
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cf980bb8d8ae9057ff80bd6313158997b1cee1fd664e3e4fef819d1cf3ba5cac469e55e02e8c4d1a2e70bf53658a58cd6c524e93da00fb2dc7a228bdda1a195
|
7
|
+
data.tar.gz: 109fe7195032238f53ed001910db4bdce5e58a89543b45c2aefc88046f7e649b68cd77421dc005fa932fe1984e610349597b1f5ffb60fde9550356b91585f5b9
|
data/README.md
CHANGED
@@ -87,7 +87,7 @@ class NewCommentNotifier < Noticed::Event
|
|
87
87
|
|
88
88
|
deliver_by :email do |config|
|
89
89
|
config.mailer = "CommentMailer"
|
90
|
-
|
90
|
+
config.if = ->(recipient) { !!recipient.preferences[:email] }
|
91
91
|
end
|
92
92
|
|
93
93
|
bulk_deliver_by :discord do |config|
|
@@ -201,7 +201,7 @@ en:
|
|
201
201
|
notifiers:
|
202
202
|
new_comment_notifier:
|
203
203
|
notification:
|
204
|
-
|
204
|
+
message: "Someone posted a new comment!"
|
205
205
|
```
|
206
206
|
|
207
207
|
Or, if you have your Notifier within another module, such as `Admin::NewCommentNotifier`, the resulting lookup path will be `en.notifiers.admin.new_comment_notifier.notification.message` (modules become nesting steps).
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Noticed
|
2
|
+
class NotificationChannel < ApplicationCable::Channel
|
3
|
+
def subscribed
|
4
|
+
stream_for current_user
|
5
|
+
end
|
6
|
+
|
7
|
+
def unsubscribed
|
8
|
+
stop_all_streams
|
9
|
+
end
|
10
|
+
|
11
|
+
def mark_as_seen(data)
|
12
|
+
current_user.notifications.where(id: data["ids"]).mark_as_seen
|
13
|
+
end
|
14
|
+
|
15
|
+
def mark_as_read(data)
|
16
|
+
current_user.notifications.where(id: data["ids"]).mark_as_read
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Noticed
|
2
2
|
module DeliveryMethods
|
3
3
|
class ActionCable < DeliveryMethod
|
4
|
-
required_options :
|
4
|
+
required_options :message
|
5
5
|
|
6
6
|
def deliver
|
7
|
-
channel = fetch_constant(:channel)
|
8
|
-
stream = evaluate_option(:stream)
|
7
|
+
channel = fetch_constant(:channel) || Noticed::NotificationChannel
|
8
|
+
stream = evaluate_option(:stream) || recipient
|
9
9
|
message = evaluate_option(:message)
|
10
10
|
|
11
11
|
channel.broadcast_to stream, message
|
data/lib/noticed/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noticed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- MIT-LICENSE
|
36
36
|
- README.md
|
37
37
|
- Rakefile
|
38
|
+
- app/channels/noticed/notification_channel.rb
|
38
39
|
- app/jobs/noticed/application_job.rb
|
39
40
|
- app/jobs/noticed/event_job.rb
|
40
41
|
- app/models/concerns/noticed/deliverable.rb
|
@@ -93,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
94
|
- !ruby/object:Gem::Version
|
94
95
|
version: '0'
|
95
96
|
requirements: []
|
96
|
-
rubygems_version: 3.5.
|
97
|
+
rubygems_version: 3.5.4
|
97
98
|
signing_key:
|
98
99
|
specification_version: 4
|
99
100
|
summary: Notifications for Ruby on Rails applications
|