activity_notification 2.1.2 → 2.1.3
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/CHANGELOG.md +11 -0
- data/Gemfile +2 -1
- data/activity_notification.gemspec +1 -1
- data/app/channels/activity_notification/notification_api_with_devise_channel.rb +1 -1
- data/app/channels/activity_notification/notification_channel.rb +1 -1
- data/app/channels/activity_notification/notification_with_devise_channel.rb +1 -1
- data/app/controllers/activity_notification/subscriptions_api_controller.rb +1 -1
- data/docs/Setup.md +14 -0
- data/gemfiles/Gemfile.rails-4.2 +2 -1
- data/gemfiles/Gemfile.rails-5.0 +2 -1
- data/gemfiles/Gemfile.rails-5.1 +2 -1
- data/gemfiles/Gemfile.rails-5.2 +2 -1
- data/gemfiles/Gemfile.rails-6.0 +2 -1
- data/lib/activity_notification/controllers/common_controller.rb +1 -1
- data/lib/activity_notification/models/concerns/notifiable.rb +1 -1
- data/lib/activity_notification/orm/mongoid/notification.rb +3 -1
- data/lib/activity_notification/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a517c56b317fe1705d3666039793aee93ed55c77c2493b70018eb1da4268f97
|
4
|
+
data.tar.gz: ba26afa004950dc8ec175abb6f36a948014f3ff7be81b8d185665f25f22137fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88b587552a4c2e1bfeda92759b44f7611309409b3bfb11c7a777739a30e3af4f28f96d532b39c42edfed0b07de274239014d6d117590f51dc1ac09fc8898e8de
|
7
|
+
data.tar.gz: c9e40bf9e14e6c5c0f4898161748e2ab07e9b1e95c8fbb2daaf151a5d94bab9727280f840216c7375819aac2f6564659d9fa9b05ce8a320dd2e3c7b42269acb3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 2.1.3 / 2020-08-1
|
2
|
+
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v2.1.2...v2.1.3)
|
3
|
+
|
4
|
+
Enhancements:
|
5
|
+
|
6
|
+
* Enable to use namespaced model - [#132](https://github.com/simukappu/activity_notification/pull/132)
|
7
|
+
|
8
|
+
Bug Fixes:
|
9
|
+
|
10
|
+
* Fix mongoid any_of selector error in filtered_by_group scope - [MONGOID-4887](https://jira.mongodb.org/browse/MONGOID-4887)
|
11
|
+
|
1
12
|
## 2.1.2 / 2020-02-24
|
2
13
|
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v2.1.1...v2.1.2)
|
3
14
|
|
data/Gemfile
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_development_dependency 'pg', '>= 1.0.0'
|
32
32
|
s.add_development_dependency 'mongoid', '>= 4.0.0'
|
33
33
|
s.add_development_dependency 'dynamoid', '3.1.0'
|
34
|
-
s.add_development_dependency 'rspec-rails', '>= 3.8.0'
|
34
|
+
s.add_development_dependency 'rspec-rails', '>= 3.8.0', '< 4.0.0'
|
35
35
|
s.add_development_dependency 'factory_bot_rails', '>= 4.11.0', '< 5.0.0'
|
36
36
|
s.add_development_dependency 'simplecov', '~> 0'
|
37
37
|
s.add_development_dependency 'yard', '>= 0.9.16'
|
@@ -24,7 +24,7 @@ if defined?(ActionCable)
|
|
24
24
|
# @return [Object] Target instance (Reject subscription when request parameters are not enough)
|
25
25
|
def set_target
|
26
26
|
reject and return if (target_type = params[:target_type]).blank?
|
27
|
-
if params[:target_id].blank? && params["#{target_type.to_s.to_resource_name}_id"].blank?
|
27
|
+
if params[:target_id].blank? && params["#{target_type.to_s.to_resource_name[/([^\/]+)$/]}_id"].blank?
|
28
28
|
reject and return if params[:devise_type].blank?
|
29
29
|
current_target = find_current_target(params[:devise_type])
|
30
30
|
params[:target_id] = target_type.to_model_class.resolve_current_devise_target(current_target)
|
@@ -22,7 +22,7 @@ if defined?(ActionCable)
|
|
22
22
|
target_class = target_type.to_s.to_model_class
|
23
23
|
@target = params[:target_id].present? ?
|
24
24
|
target_class.find_by!(id: params[:target_id]) :
|
25
|
-
target_class.find_by!(id: params["#{target_type.to_s.to_resource_name}_id"])
|
25
|
+
target_class.find_by!(id: params["#{target_type.to_s.to_resource_name[/([^\/]+)$/]}_id"])
|
26
26
|
rescue
|
27
27
|
reject
|
28
28
|
end
|
@@ -29,7 +29,7 @@ if defined?(ActionCable)
|
|
29
29
|
# @return [Object] Target instance (Reject subscription when request parameters are not enough)
|
30
30
|
def set_target
|
31
31
|
reject and return if (target_type = params[:target_type]).blank?
|
32
|
-
if params[:target_id].blank? && params["#{target_type.to_s.to_resource_name}_id"].blank?
|
32
|
+
if params[:target_id].blank? && params["#{target_type.to_s.to_resource_name[/([^\/]+)$/]}_id"].blank?
|
33
33
|
reject and return if params[:devise_type].blank?
|
34
34
|
current_target = find_current_target(params[:devise_type])
|
35
35
|
params[:target_id] = target_type.to_model_class.resolve_current_devise_target(current_target)
|
@@ -44,7 +44,7 @@ module ActivityNotification
|
|
44
44
|
params[:subscription][:optional_targets]["subscribing_to_#{optional_target_name}"] = subscribing_param unless subscribing_param.nil?
|
45
45
|
end
|
46
46
|
super
|
47
|
-
render status: 201,
|
47
|
+
render status: 201, json: subscription_json if @subscription
|
48
48
|
end
|
49
49
|
|
50
50
|
# Finds and shows a subscription from specified key.
|
data/docs/Setup.md
CHANGED
@@ -343,6 +343,20 @@ end
|
|
343
343
|
Then, you can access several pages like */users/1/notifications* and manage open/unopen of notifications using *[ActivityNotification::NotificationsController](/app/controllers/activity_notification/notifications_controller.rb)*.
|
344
344
|
If you use Devise integration and you want to configure simple default routes for authenticated users, see [Configuring simple default routes](#configuring-simple-default-routes).
|
345
345
|
|
346
|
+
#### Routes with namespaced model
|
347
|
+
|
348
|
+
It is possible to configure a target model as a submodule, e.g. if your target is `Entity::User`,
|
349
|
+
however by default the **ActivityNotification** controllers will be placed under the same namespace,
|
350
|
+
so it is mandatory to explicitly call the controllers this way
|
351
|
+
|
352
|
+
```ruby
|
353
|
+
Rails.application.routes.draw do
|
354
|
+
notify_to :users, controller: '/activity_notification/notifications', target_type: 'entity/users'
|
355
|
+
end
|
356
|
+
```
|
357
|
+
|
358
|
+
This will generate the necessary routes for the `Entity::User` target with parameters `:user_id`
|
359
|
+
|
346
360
|
#### Routes with scope
|
347
361
|
|
348
362
|
You can also configure *activity_notification* routes with scope like this:
|
data/gemfiles/Gemfile.rails-4.2
CHANGED
data/gemfiles/Gemfile.rails-5.0
CHANGED
data/gemfiles/Gemfile.rails-5.1
CHANGED
data/gemfiles/Gemfile.rails-5.2
CHANGED
data/gemfiles/Gemfile.rails-6.0
CHANGED
@@ -26,7 +26,7 @@ module ActivityNotification
|
|
26
26
|
target_class = target_type.to_model_class
|
27
27
|
@target = params[:target_id].present? ?
|
28
28
|
target_class.find_by!(id: params[:target_id]) :
|
29
|
-
target_class.find_by!(id: params["#{target_type.to_resource_name}_id"])
|
29
|
+
target_class.find_by!(id: params["#{target_type.to_resource_name[/([^\/]+)$/]}_id"])
|
30
30
|
else
|
31
31
|
render status: 400, json: error_response(code: 400, message: "Invalid parameter", type: "Parameter is missing or the value is empty: target_type")
|
32
32
|
end
|
@@ -140,7 +140,9 @@ module ActivityNotification
|
|
140
140
|
scope :filtered_by_group, ->(group) {
|
141
141
|
group.present? ?
|
142
142
|
where(group_id: group.id, group_type: group.class.name) :
|
143
|
-
|
143
|
+
Gem::Version.new(::Mongoid::VERSION) >= Gem::Version.new('7.1.0') ?
|
144
|
+
where(:group_id.exists => false, :group_type.exists => false).or(group_id: nil, group_type: nil) :
|
145
|
+
any_of({ :group_id.exists => false, :group_type.exists => false }, { group_id: nil, group_type: nil })
|
144
146
|
}
|
145
147
|
|
146
148
|
# Selects filtered notifications later than specified time.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activity_notification
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shota Yamazaki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -163,6 +163,9 @@ dependencies:
|
|
163
163
|
- - ">="
|
164
164
|
- !ruby/object:Gem::Version
|
165
165
|
version: 3.8.0
|
166
|
+
- - "<"
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: 4.0.0
|
166
169
|
type: :development
|
167
170
|
prerelease: false
|
168
171
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -170,6 +173,9 @@ dependencies:
|
|
170
173
|
- - ">="
|
171
174
|
- !ruby/object:Gem::Version
|
172
175
|
version: 3.8.0
|
176
|
+
- - "<"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: 4.0.0
|
173
179
|
- !ruby/object:Gem::Dependency
|
174
180
|
name: factory_bot_rails
|
175
181
|
requirement: !ruby/object:Gem::Requirement
|