notify_user 0.0.18 → 0.0.19

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
  SHA1:
3
- metadata.gz: f2f9b58ce074b105f68e37d8eae5e5d596e68eaa
4
- data.tar.gz: 7c9d3f5ec8fb866b41c6ebfef76e2de9fdf5944e
3
+ metadata.gz: c1dd2facd94fde1472249cc3e3a65c61121b69ab
4
+ data.tar.gz: 6dbed392b3547e7732300cefddb6abfcb8ad6b5f
5
5
  SHA512:
6
- metadata.gz: 4135018f856c8fecd21f18d09835bbcf5f456f13e66fe70c302069274f2059721827391e30e3787f3b6aea2e8b1a3751a6cdafef3d26f05b30c3d5ec581960ed
7
- data.tar.gz: cedf97048526280dbf15eb481df74b26aa6f7e7775996d562b9a31e3754a878e58f75e4097b6d381d235d64c4bdd6d813bd8bc9a188786c6c2accc47eeebb4c7
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
@@ -1,3 +1,3 @@
1
1
  module NotifyUser
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end