mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Introduce a Service::ActionBase class for service actions
This will help to enforce a consistent pattern for creating service actions. This patch also namespaces actions and policies, making everything related to a service available directly in `app/services/<concept-name>`, making things more consistent at that level too.
This commit is contained in:
committed by
Loïc Guitaut
parent
aa9c59a24b
commit
05b8ff436c
19
lib/service/policy_base.rb
Normal file
19
lib/service/policy_base.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Service::PolicyBase
|
||||
attr_reader :context
|
||||
|
||||
delegate :guardian, to: :context
|
||||
|
||||
def initialize(context)
|
||||
@context = context
|
||||
end
|
||||
|
||||
def call
|
||||
raise "Not implemented"
|
||||
end
|
||||
|
||||
def reason
|
||||
raise "Not implemented"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user