Commit d7ac948c authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Fix incorrect class definitions

Zeitwerk requires that class definitions match the file location
parent 1ae9e05f
# frozen_string_literal: true # frozen_string_literal: true
module InvisibleCaptcha module InvisibleCaptchaOnSignup
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
......
...@@ -4,7 +4,7 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -4,7 +4,7 @@ class RegistrationsController < Devise::RegistrationsController
include Recaptcha::Verify include Recaptcha::Verify
include AcceptsPendingInvitations include AcceptsPendingInvitations
include RecaptchaExperimentHelper include RecaptchaExperimentHelper
include InvisibleCaptcha include InvisibleCaptchaOnSignup
layout :choose_layout layout :choose_layout
......
# frozen_string_literal: true # frozen_string_literal: true
module EE class WeightNote < ::Note
class WeightNote < ::Note attr_accessor :resource_parent, :event
attr_accessor :resource_parent, :event
def self.from_event(event, resource: nil, resource_parent: nil)
def self.from_event(event, resource: nil, resource_parent: nil) resource ||= event.issue
resource ||= event.issue
attrs = {
attrs = { system: true,
system: true, author: event.user,
author: event.user, created_at: event.created_at,
created_at: event.created_at, noteable: resource,
noteable: resource, event: event,
event: event, discussion_id: event.discussion_id,
discussion_id: event.discussion_id, system_note_metadata: ::SystemNoteMetadata.new(action: 'weight'),
system_note_metadata: ::SystemNoteMetadata.new(action: 'weight'), resource_parent: resource_parent
resource_parent: resource_parent }
}
if resource_parent.is_a?(Project)
if resource_parent.is_a?(Project) attrs[:project_id] = resource_parent.id
attrs[:project_id] = resource_parent.id
end
WeightNote.new(attrs)
end end
def note WeightNote.new(attrs)
@note ||= note_text end
end
def note_html def note
@note_html ||= "<p dir=\"auto\">#{note_text(html: true)}</p>" @note ||= note_text
end end
def project def note_html
resource_parent if resource_parent.is_a?(Project) @note_html ||= "<p dir=\"auto\">#{note_text(html: true)}</p>"
end end
def group def project
resource_parent if resource_parent.is_a?(Group) resource_parent if resource_parent.is_a?(Project)
end end
private def group
resource_parent if resource_parent.is_a?(Group)
end
def note_text(html: false) private
weight_text = html ? "<strong>#{event.weight}</strong>" : event.weight
event.weight ? "changed weight to #{weight_text}" : 'removed the weight' def note_text(html: false)
end weight_text = html ? "<strong>#{event.weight}</strong>" : event.weight
event.weight ? "changed weight to #{weight_text}" : 'removed the weight'
end end
end end
...@@ -13,6 +13,8 @@ require_dependency 'declarative_policy/step' ...@@ -13,6 +13,8 @@ require_dependency 'declarative_policy/step'
require_dependency 'declarative_policy/base' require_dependency 'declarative_policy/base'
module DeclarativePolicy module DeclarativePolicy
extend PreferredScope
CLASS_CACHE_MUTEX = Mutex.new CLASS_CACHE_MUTEX = Mutex.new
CLASS_CACHE_IVAR = :@__DeclarativePolicy_CLASS_CACHE CLASS_CACHE_IVAR = :@__DeclarativePolicy_CLASS_CACHE
......
# frozen_string_literal: true # frozen_string_literal: true
module DeclarativePolicy module DeclarativePolicy
PREFERRED_SCOPE_KEY = :"DeclarativePolicy.preferred_scope" module PreferredScope
PREFERRED_SCOPE_KEY = :"DeclarativePolicy.preferred_scope"
class << self
def with_preferred_scope(scope) def with_preferred_scope(scope)
Thread.current[PREFERRED_SCOPE_KEY], old_scope = scope, Thread.current[PREFERRED_SCOPE_KEY] Thread.current[PREFERRED_SCOPE_KEY], old_scope = scope, Thread.current[PREFERRED_SCOPE_KEY]
yield yield
......
# frozen_string_literal: true
module Gitlab
module Email
ProcessingError = Class.new(StandardError)
EmailUnparsableError = Class.new(ProcessingError)
SentNotificationNotFoundError = Class.new(ProcessingError)
ProjectNotFound = Class.new(ProcessingError)
EmptyEmailError = Class.new(ProcessingError)
AutoGeneratedEmailError = Class.new(ProcessingError)
UserNotFoundError = Class.new(ProcessingError)
UserBlockedError = Class.new(ProcessingError)
UserNotAuthorizedError = Class.new(ProcessingError)
NoteableNotFoundError = Class.new(ProcessingError)
InvalidRecordError = Class.new(ProcessingError)
InvalidNoteError = Class.new(InvalidRecordError)
InvalidIssueError = Class.new(InvalidRecordError)
InvalidMergeRequestError = Class.new(InvalidRecordError)
UnknownIncomingEmail = Class.new(ProcessingError)
InvalidAttachment = Class.new(ProcessingError)
end
end
...@@ -5,23 +5,6 @@ require_dependency 'gitlab/email/handler' ...@@ -5,23 +5,6 @@ require_dependency 'gitlab/email/handler'
# Inspired in great part by Discourse's Email::Receiver # Inspired in great part by Discourse's Email::Receiver
module Gitlab module Gitlab
module Email module Email
ProcessingError = Class.new(StandardError)
EmailUnparsableError = Class.new(ProcessingError)
SentNotificationNotFoundError = Class.new(ProcessingError)
ProjectNotFound = Class.new(ProcessingError)
EmptyEmailError = Class.new(ProcessingError)
AutoGeneratedEmailError = Class.new(ProcessingError)
UserNotFoundError = Class.new(ProcessingError)
UserBlockedError = Class.new(ProcessingError)
UserNotAuthorizedError = Class.new(ProcessingError)
NoteableNotFoundError = Class.new(ProcessingError)
InvalidRecordError = Class.new(ProcessingError)
InvalidNoteError = Class.new(InvalidRecordError)
InvalidIssueError = Class.new(InvalidRecordError)
InvalidMergeRequestError = Class.new(InvalidRecordError)
UnknownIncomingEmail = Class.new(ProcessingError)
InvalidAttachment = Class.new(ProcessingError)
class Receiver class Receiver
def initialize(raw) def initialize(raw)
@raw = raw @raw = raw
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment