diff options
author | Alex Kalderimis <alex.kalderimis@gmail.com> | 2019-08-20 22:37:09 +0100 |
---|---|---|
committer | Alex Kalderimis <alex.kalderimis@gmail.com> | 2019-08-20 22:37:09 +0100 |
commit | 6690185d800c28acc70719abaf2b24633d668b4a (patch) | |
tree | 0e4cda52157600aca71b9cf1f29f4209a6a04db4 | |
parent | 8db842e8f8d0eb8a53c4cf6378e655ed3f469a96 (diff) | |
download | gitlab-ce-demodulize-model-headers.tar.gz |
Explain what the arguments to add_model_headers aredemodulize-model-headers
-rw-r--r-- | app/mailers/notify.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 9d2deb35cd4..3683f2ea9a9 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -195,12 +195,16 @@ class Notify < BaseMailer @reply_key ||= SentNotification.reply_key end - def add_model_headers(model) + # This method applies threading headers to the email to identify + # the instance we are discussing. + # + # All model instances must have `#id`, and may implement `#iid`. + def add_model_headers(object) # Use replacement so we don't strip the module. - prefix = "X-GitLab-#{model.class.name.gsub(/::/, '-')}" + prefix = "X-GitLab-#{object.class.name.gsub(/::/, '-')}" - headers["#{prefix}-ID"] = model.id if model.respond_to?(:id) - headers["#{prefix}-IID"] = model.iid if model.respond_to?(:iid) + headers["#{prefix}-ID"] = object.id + headers["#{prefix}-IID"] = object.iid if object.respond_to?(:iid) end def add_project_headers |