Commit 54eb6260 authored by Brett Walker's avatar Brett Walker

Address review feedback

parent 2e514314
...@@ -11,7 +11,7 @@ module Gitlab ...@@ -11,7 +11,7 @@ module Gitlab
@mail_key = mail_key @mail_key = mail_key
end end
def can_execute? def can_handle?
raise NotImplementedError raise NotImplementedError
end end
......
...@@ -11,8 +11,9 @@ module Gitlab ...@@ -11,8 +11,9 @@ module Gitlab
class UnsubscribeHandler < BaseHandler class UnsubscribeHandler < BaseHandler
delegate :project, to: :sent_notification, allow_nil: true delegate :project, to: :sent_notification, allow_nil: true
HANDLER_REGEX = /\A(?<reply_token>\w+)#{Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX}\z/.freeze HANDLER_REGEX_FOR = -> (suffix) { /\A(?<reply_token>\w+)#{Regexp.escape(suffix)}\z/ }.freeze
HANDLER_REGEX_LEGACY = /\A(?<reply_token>\w+)#{Regexp.escape(Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX_LEGACY)}\z/.freeze HANDLER_REGEX = HANDLER_REGEX_FOR.call(Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX).freeze
HANDLER_REGEX_LEGACY = HANDLER_REGEX_FOR.call(Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX_LEGACY).freeze
def initialize(mail, mail_key) def initialize(mail, mail_key)
super(mail, mail_key) super(mail, mail_key)
...@@ -37,8 +38,10 @@ module Gitlab ...@@ -37,8 +38,10 @@ module Gitlab
private private
attr_reader :reply_token
def sent_notification def sent_notification
@sent_notification ||= SentNotification.for(@reply_token) @sent_notification ||= SentNotification.for(reply_token)
end end
end end
end end
......
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