notify_user 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/notify_user/base_notifications_controller.rb +19 -0
- data/app/models/notify_user/base_notification.rb +0 -5
- data/config/routes.rb +2 -0
- data/lib/notify_user/version.rb +1 -1
- data/spec/dummy/rails-4.0.4/log/test.log +1113 -0
- data/spec/dummy/rails-4.0.4/tmp/cache/assets/test/sprockets/0a7202620c53dddd506d0a94e2800d40 +0 -0
- data/spec/dummy/rails-4.0.4/tmp/cache/assets/test/sprockets/0d3ce22aa7fdd86ca27a4cf75e4f57d7 +0 -0
- data/spec/dummy/rails-4.0.4/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/rails-4.0.4/tmp/cache/assets/test/sprockets/35025e256922e55fb999ec21dd95fa29 +0 -0
- data/spec/dummy/rails-4.0.4/tmp/cache/assets/test/sprockets/9c7f6978ddc871d6e3ac0032be398a00 +0 -0
- data/spec/dummy/rails-4.0.4/tmp/cache/assets/test/sprockets/c5b062f65e9c52603e1d81e4a1e66a86 +0 -0
- data/spec/dummy/rails-4.0.4/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/rails-4.0.4/tmp/cache/assets/test/sprockets/fa5fa8289c6899f4bf819fb198773fcf +0 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1dd2facd94fde1472249cc3e3a65c61121b69ab
|
4
|
+
data.tar.gz: 6dbed392b3547e7732300cefddb6abfcb8ad6b5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c612f793c3816c16aa92e2c373c26fc100a02b5a7220d89a7d6a98952bd98be5ecf36c4a5ece9a2b42c4c18b6eb28c329fdc729f45274c5f626094e984dfe678
|
7
|
+
data.tar.gz: a57d58340f7cffc6218f7d0d7f35097ac176e786e95d0c4b70791d5d45ba5b049b99f90e3209cd691bbb8a3a6d3dbcb41962ea6284371b692c0b38f1cd915e9e
|
@@ -73,6 +73,25 @@ class NotifyUser::BaseNotificationsController < ApplicationController
|
|
73
73
|
render :json => @types
|
74
74
|
end
|
75
75
|
|
76
|
+
def mass_subscriptions
|
77
|
+
types = build_notification_types()
|
78
|
+
if params[:type]
|
79
|
+
types[:subscriptions].each do |type|
|
80
|
+
unsubscribe = NotifyUser::Unsubscribe.has_unsubscribed_from(@user, type[:type])
|
81
|
+
if params[:type][type[:type]] == "1"
|
82
|
+
NotifyUser::Unsubscribe.unsubscribe(@user,type[:type])
|
83
|
+
else
|
84
|
+
if unsubscribe.empty?
|
85
|
+
#if unsubscribe doesn't exist create it
|
86
|
+
unsubscribe = NotifyUser::Unsubscribe.create(target: @user, type: type[:type])
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
flash[:message] = "Successfully updated your notifcation settings"
|
91
|
+
end
|
92
|
+
redirect_to notify_user_notifications_unsubscribe_path
|
93
|
+
end
|
94
|
+
|
76
95
|
def update_subscriptions(types)
|
77
96
|
types.each do |type|
|
78
97
|
unsubscribe = NotifyUser::Unsubscribe.has_unsubscribed_from(@user, type[:type])
|
@@ -124,11 +124,6 @@ module NotifyUser
|
|
124
124
|
self.description = ""
|
125
125
|
|
126
126
|
## Channels
|
127
|
-
# class << self
|
128
|
-
# attr_accessor :channels
|
129
|
-
# attr_writer :channels
|
130
|
-
# end
|
131
|
-
|
132
127
|
class_attribute :channels
|
133
128
|
self.channels = {
|
134
129
|
action_mailer: {description: 'Email notifications'}
|
data/config/routes.rb
CHANGED
@@ -10,5 +10,7 @@ Rails.application.routes.draw do
|
|
10
10
|
get 'notifications/unauth_unsubscribe' => 'notifications#unauth_unsubscribe'
|
11
11
|
get 'notifications/subscriptions' => 'notifications#subscriptions'
|
12
12
|
put 'notifications/subscriptions' => 'notifications#subscriptions'
|
13
|
+
put 'notifications/mass_subscriptions' => 'notifications#mass_subscriptions'
|
14
|
+
|
13
15
|
end
|
14
16
|
end
|
data/lib/notify_user/version.rb
CHANGED