Sha256: 959c72e22c5ba9395fa75deb4bfe444a4690ba377d761e415a5430c7606a18a9
Contents?: true
Size: 707 Bytes
Versions: 65
Compression:
Stored size: 707 Bytes
Contents
# frozen_string_literal: true module Decidim # The controller to handle the user's notifications deletion. class NotificationsController < Decidim::ApplicationController def index enforce_permission_to :read, :notification end def destroy notification = notifications.find(params[:id]) enforce_permission_to :destroy, :notification, notification: notification notification.destroy end def read_all enforce_permission_to :destroy, :notification, notification: notifications.first notifications.destroy_all end private def notifications @notifications ||= current_user.notifications.order(created_at: :desc) end end end
Version data entries
65 entries across 65 versions & 1 rubygems