Add ability to view individual newsletters in admin UI (#39271)
This commit is contained in:
1 parent
a5e763c330
commit
ea5b613796
44 files changed
+248
-72
No files matched your search
@@ -1,6 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Admin::EmailSubscriptionsController < Admin::BaseController
|
||||
before_action :set_email_subscription, only: :destroy
|
||||
|
||||
def index
|
||||
authorize :email_subscription, :index?
|
||||
|
||||
@@ -9,6 +11,12 @@ class Admin::EmailSubscriptionsController < Admin::BaseController
|
||||
@accounts = Account.local.where.associated(:email_subscriptions).includes(:user)
|
||||
end
|
||||
|
||||
def destroy
|
||||
authorize :email_subscription, :destroy?
|
||||
@email_subscription.destroy!
|
||||
redirect_to admin_email_subscriptions_account_path(@email_subscription.account_id)
|
||||
end
|
||||
|
||||
def disable
|
||||
authorize :email_subscription, :disable?
|
||||
Setting.email_subscriptions = false
|
||||
@@ -20,4 +28,10 @@ class Admin::EmailSubscriptionsController < Admin::BaseController
|
||||
Admin::EmailSubscriptionsPurgeWorker.perform_async
|
||||
redirect_to admin_email_subscriptions_path, notice: I18n.t('admin.email_subscriptions.purged_msg')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_email_subscription
|
||||
@email_subscription = EmailSubscription.find(params[:id])
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user