docbrown/app/controllers/admin/application_controller.rb
Michael Kohl 09828853f6
✂✂✂ Remove Connect (#14734)
* Remove Connect

* Remove more Connect specs

* Remove a lot more Connect code

* 🚮

* It all has to go

* Explicitly add httpclient

* Update application layout

* Remove messages association from User

* Start fixing specs

* reintroduce util function and refactor references

* Remove Connect Cypress test

* Fix more specs

* Remove Connect from listings

* Ignore contact_via_connect column on listings

* Remove contact_via_connect usages

* Ignore mod_chat_channel_id on tags

* Drop Connect tables

* Remove email_connect_messages from user notification settings

* Re-add httpclient 2.8.3

This was mistakenly removed as a merge conflict

* Don't need to exclude removed chat channel file

* Remove unneeded style for chat channels

* Remove unneeded channel list prop type

* Remove chat channels index/connect-link from getPageEntries

* Re-add comment from httpclient in Gemfile

* Remove connect references from mailers

Tag Moderators no longer have a chat channel

No longer will users be notified about new messages (there won't be
any)

No longer will users be notified about channel invites (you can't
invite anyone anymore)

* Don't configure Pusher and remove PUSHER_* from .env_sample

since it's removed from gemfile, the Pusher constant will not resolve, if this is
configured in the environment variables we'll fail to boot.

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Dan Uber <dan@forem.com>
2021-11-18 08:21:00 -06:00

39 lines
1.7 KiB
Ruby

module Admin
class ApplicationController < ApplicationController
before_action :authorize_admin
before_action :assign_help_url
after_action :verify_authorized
HELP_URLS = {
articles: "https://admin.forem.com/docs/forem-basics/posts",
badges: "https://admin.forem.com/docs/forem-basics/badges",
badge_achievements: "https://admin.forem.com/docs/forem-basics/badges",
display_ads: "https://admin.forem.com/docs/advanced-customization/display-ads",
feedback_messages: "https://admin.forem.com/docs/advanced-customization/reports",
html_variants: "https://admin.forem.com/docs/advanced-customization/html-variants",
navigation_links: "https://admin.forem.com/docs/advanced-customization/navigation-links",
organizations: "https://admin.forem.com/docs/managing-your-community/organization-pages",
pages: "https://admin.forem.com/docs/forem-basics/pages",
permissions: "https://admin.forem.com/docs/forem-basics/user-roles",
podcasts: "https://admin.forem.com/docs/advanced-customization/content-manager/podcasts",
settings: "https://admin.forem.com/docs/advanced-customization/config",
tags: "https://admin.forem.com/docs/forem-basics/tags",
users: "https://admin.forem.com/docs/forem-basics/user-roles",
creator_settings: "https://admin.forem.com/docs/getting-started/first-user-registration"
}.freeze
protected
def authorization_resource
self.class.name.sub("Admin::", "").sub("Controller", "").singularize.constantize
end
def authorize_admin
authorize(authorization_resource, :access?, policy_class: InternalPolicy)
end
def assign_help_url
@help_url = HELP_URLS[controller_name.to_sym]
end
end
end