Add backend for the moderators
Add new routes for the proposal notifications edition and abilities to let moderators edit it (mark as ignored, hide, etc.). The notifications are not flaggable because they doesn't work like that, but in a similar way. The moderator/administrator is in charge of hidding them through the UI, so the normal users don't flag it as inappropriate. New controller Moderation::ProposalNotification to manage the moderators work.
This commit is contained in:
30
app/controllers/admin/proposal_notifications_controller.rb
Normal file
30
app/controllers/admin/proposal_notifications_controller.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
class Admin::ProposalNotificationsController < Admin::BaseController
|
||||
|
||||
has_filters %w{without_confirmed_hide all with_confirmed_hide}, only: :index
|
||||
|
||||
before_action :load_proposal, only: [:confirm_hide, :restore]
|
||||
|
||||
def index
|
||||
@proposal_notifications = ProposalNotification.only_hidden.send(@current_filter).order(hidden_at: :desc)
|
||||
.page(params[:page])
|
||||
end
|
||||
|
||||
def confirm_hide
|
||||
@proposal_notification.confirm_hide
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
end
|
||||
|
||||
def restore
|
||||
@proposal_notification.restore
|
||||
@proposal_notification.ignore_flag
|
||||
Activity.log(current_user, :restore, @proposal_notification)
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_proposal
|
||||
@proposal_notification = ProposalNotification.with_hidden.find(params[:id])
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user