* Trigger Build * WIP - use turbo to render html for create post button todos and discussion topics [] add tests (probably gonna be a lot of cypress 😅😭) [] nominclature & file structure for authorization controller/routes [] is this "authorizations" namespace approach the best? [] authorization strategy relies on current user and caching doesn't like `current_user` * Use URL helper and not change the policy just yet * put the turbo frame behind a feature flag * Trigger Build * Use URL helper and not change the policy just yet * :) * Add some test coverage and use same feature flag for consistency * rubocop * more rubocop * trigger build * adding a small sleep to see if specs pass 😩 * remove sleep * disable Turbo session drive * WIP * Revert "WIP" This reverts commit ce838672069fd703122156a0d82e5e6ad5398e0a. * Moving spec from dashboard to root With forem/forem#16913 the underlying test broke because we were redirecting on the dashboard. Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
16 lines
409 B
Ruby
16 lines
409 B
Ruby
module Authorization
|
|
class ArticlesController < ApplicationController
|
|
include ApplicationHelper
|
|
layout false
|
|
|
|
before_action :authenticate_user!
|
|
after_action :verify_authorized
|
|
|
|
def create_post_button
|
|
authorize Article, :create?
|
|
unless FeatureFlag.enabled?(:limit_post_creation_to_admins)
|
|
render file: "public/404.html", status: :not_found
|
|
end
|
|
end
|
|
end
|
|
end
|