meta_notification 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/meta_notification/api/v1/notifications_controller.rb +1 -0
- data/app/controllers/meta_notification/api/v1/user_notifications_controller.rb +2 -2
- data/app/views/meta_notification/api/v1/notifications/resource_notification.rabl +2 -2
- data/config/routes.rb +1 -0
- data/lib/meta_notification/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 947202e0d0156a9405175275a20bca47515634d1
|
4
|
+
data.tar.gz: 6b7bb55641e4cc1cff355e62912a87f11ca7a317
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8df0666e6e64102e5a4bebd689a424ef069f536f7ccdb89aee09e2fd0dfa06d807a3aef87d9cb364e189942a5b4521545456c305049e161857114443d3c81d75
|
7
|
+
data.tar.gz: 4bd5015840bfd5eae39e8a34b5868485c9bef2f5a7b9018632a68d1fff1f6ef96b1ab06b25b68c65b54c7630f7b5a15b778bbd529e60ceb3eebc7b58bd50e1f0
|
@@ -11,6 +11,7 @@ module MetaNotification
|
|
11
11
|
.joins('JOIN mn_notification_types on mn_notification_types.id = mn_notification_templates.notification_type_id')
|
12
12
|
.where(resource_type: params[:resource_type], resource_id: params[:resource_id])
|
13
13
|
.includes(:users)
|
14
|
+
.page(params[:current_page]) if params[:current_page].present?
|
14
15
|
@created_by_users = User.where(id: @notifications.map(&:created_by_id).uniq)
|
15
16
|
|
16
17
|
end
|
@@ -8,7 +8,7 @@ module MetaNotification
|
|
8
8
|
before_action :init_authorizer
|
9
9
|
|
10
10
|
before_action :set_user_notification, only: [:update, :show]
|
11
|
-
before_action :set_notification_type_ids_for_filter, only: [:notifications, :mark_all_read, :mark_all_read]
|
11
|
+
before_action :set_notification_type_ids_for_filter, only: [:notifications, :mark_all_read, :mark_all_read, :unread_count]
|
12
12
|
|
13
13
|
def show
|
14
14
|
end
|
@@ -53,7 +53,7 @@ module MetaNotification
|
|
53
53
|
|
54
54
|
def unread_count
|
55
55
|
mobile_or_in_app = (params[:platform] == 'mobile') ? 'mobile'.to_sym : 'in_app'.to_sym
|
56
|
-
unread_count = MetaNotification::Notification.select(:id, 'mn_notifications.*', 'mn_user_notifications.id as mn_user_notification_id', 'mn_user_notifications.user_id', mobile_or_in_app, 'mn_user_notifications.is_read', 'mn_notification_types.name'
|
56
|
+
unread_count = MetaNotification::Notification.select(:id, 'mn_notifications.*', 'mn_user_notifications.id as mn_user_notification_id', 'mn_user_notifications.user_id', mobile_or_in_app, 'mn_user_notifications.is_read', 'mn_notification_types.name')
|
57
57
|
.joins('JOIN mn_user_notifications on mn_user_notifications.notification_id = mn_notifications.id')
|
58
58
|
.joins('JOIN mn_notification_types on mn_notification_types.id = mn_user_notifications.notification_type_id')
|
59
59
|
.where('mn_user_notifications.user_id' => params[:user_id], 'mn_user_notifications.notification_type_id' => @notification_type_in_ids, 'mn_user_notifications.is_read' => false)
|
@@ -2,8 +2,8 @@ collection @notifications
|
|
2
2
|
attributes :id, :in_app, :mobile, :label, :icon, :created_at
|
3
3
|
node :template_name, &:name
|
4
4
|
node :created_by do |notification|
|
5
|
-
user = @created_by_users.map { |user| user if notification.created_by_id == user.id }.first
|
6
|
-
{ id: user.id, email: user.email, first_name: user.first_name, last_name: user.last_name }
|
5
|
+
user = @created_by_users.map { |user| user if notification.created_by_id == user.id }.compact.first
|
6
|
+
{ id: user.id, email: user.email, first_name: user.first_name, last_name: user.last_name } if user.present?
|
7
7
|
end
|
8
8
|
child :users do
|
9
9
|
attributes :id, :email, :first_name, :last_name
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meta_notification
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shobhit Dixit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|