Adds activity tab for system emails

This commit is contained in:
María Checa
2018-05-15 13:19:47 +02:00
committed by decabeza
parent f1e7b634ba
commit 9d580e15f5
6 changed files with 23 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
class Admin::ActivityController < Admin::BaseController
has_filters %w{all on_users on_proposals on_debates on_comments}
has_filters %w{all on_users on_proposals on_debates on_comments on_system_emails}
def show
@activity = Activity.for_render.send(@current_filter)

View File

@@ -11,6 +11,7 @@ class Activity < ActiveRecord::Base
scope :on_users, -> { where(actionable_type: 'User') }
scope :on_comments, -> { where(actionable_type: 'Comment') }
scope :on_budget_investments, -> { where(actionable_type: 'Budget::Investment') }
scope :on_system_emails, -> { where(actionable_type: 'ProposalNotification') }
scope :for_render, -> { includes(user: [:moderator, :administrator]).includes(:actionable) }
def self.log(user, action, actionable)

View File

@@ -10,6 +10,7 @@ class ProposalNotification < ActiveRecord::Base
validates :proposal, presence: true
validate :minimum_interval
scope :with_hidden, -> { all }
scope :public_for_api, -> { where(proposal_id: Proposal.public_for_api.pluck(:id)) }
scope :sort_by_created_at, -> { reorder(created_at: :desc) }
scope :sort_by_moderated, -> { reorder(moderated: :desc) }