Class: Decidim::NotificationsController
Overview
The controller to handle the user’s notifications deletion.
Instance Method Summary
collapse
#snippets
#disable_http_caching
register_permissions
enhance_controller, extended, included
Instance Method Details
#destroy ⇒ Object
10
11
12
13
14
|
# File 'app/controllers/decidim/notifications_controller.rb', line 10
def destroy
notification = notifications.find(params[:id])
enforce_permission_to :destroy, :notification, notification: notification
notification.destroy
end
|
#index ⇒ Object
6
7
8
|
# File 'app/controllers/decidim/notifications_controller.rb', line 6
def index
enforce_permission_to :read, :notification
end
|
#read_all ⇒ Object
16
17
18
19
|
# File 'app/controllers/decidim/notifications_controller.rb', line 16
def read_all
enforce_permission_to :destroy, :notification, notification: notifications.first
notifications.destroy_all
end
|