diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 98d96d34..0516063c 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -15,10 +15,15 @@ class NotificationsController < ApplicationController def mark_as_read current_user.notifications.unread.update_all(read_at: Time.zone.now) - redirect_to notifications_url, notice: 'All notifications marked as read.', status: :see_other end + + def destroy_all + current_user.notifications.destroy_all + redirect_to notifications_url, notice: 'All notifications where successfully destroyed.', status: :see_other + end + def destroy @notification.destroy! redirect_to notifications_url, notice: 'Notification was successfully destroyed.', status: :see_other diff --git a/app/views/notifications/index.html.erb b/app/views/notifications/index.html.erb index 03fd4acc..09e760fb 100644 --- a/app/views/notifications/index.html.erb +++ b/app/views/notifications/index.html.erb @@ -4,7 +4,10 @@