Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "ignore deny list" option when sending an email #360

Merged
merged 12 commits into from
Aug 13, 2020
Merged

Conversation

mlandauer
Copy link
Owner

No description provided.

" charset=UTF-8",
"Content-Transfer-Encoding: 7bit",
"",
"Hello!"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"Content-Type: text/plain;",
" charset=UTF-8",
"Content-Transfer-Encoding: 7bit",
"",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"Mime-Version: 1.0",
"Content-Type: text/plain;",
" charset=UTF-8",
"Content-Transfer-Encoding: 7bit",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"Subject: Hello",
"Mime-Version: 1.0",
"Content-Type: text/plain;",
" charset=UTF-8",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"Message-ID: <1.mail>",
"Subject: Hello",
"Mime-Version: 1.0",
"Content-Type: text/plain;",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

end

it do
connection.receive_recipient("<wibble@wobble.com>")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

" charset=UTF-8",
"Content-Transfer-Encoding: 7bit",
"",
"Hello!"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"Content-Type: text/plain;",
" charset=UTF-8",
"Content-Transfer-Encoding: 7bit",
"",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"Mime-Version: 1.0",
"Content-Type: text/plain;",
" charset=UTF-8",
"Content-Transfer-Encoding: 7bit",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"Subject: Hello",
"Mime-Version: 1.0",
"Content-Type: text/plain;",
" charset=UTF-8",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

@@ -29,7 +30,7 @@ def send?
# If there is no team there is no deny list
# In concrete terms the internal cuttlefish app doesn't have a deny
# list and isn't part of a team
app.team.nil? || address.deny_lists.find_by(team_id: app.team.id).nil?
app.team.nil? || email.ignore_deny_list || address.deny_lists.find_by(team_id: app.team.id).nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [100/80]

@@ -50,6 +52,6 @@ def call

private

attr_reader :app_id, :from, :to, :cc, :subject, :text_part, :html_part
attr_reader :app_id, :from, :to, :cc, :subject, :text_part, :html_part, :ignore_deny_list

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [93/80]

@@ -3,7 +3,7 @@
module EmailServices
class Create < ApplicationService
# rubocop:disable Naming/MethodParameterName
def initialize(app_id:, from:, to:, cc:, subject:, text_part:, html_part:)
def initialize(app_id:, from:, to:, cc:, subject:, text_part:, html_part:, ignore_deny_list:)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/ParameterLists: Avoid parameter lists longer than 5 parameters. [8/5]
Naming/UncommunicativeMethodParamName: Method parameter must be at least 3 characters long.
Metrics/LineLength: Line is too long. [97/80]

# Now check for special headers
m = Mail.new(current.data)
h = m.header[IGNORE_DENY_LIST_HEADER]
ignore_deny_list = (!h.nil? && h.value == "true")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

@@ -165,17 +165,28 @@ def process_data_line(line)
end
end

IGNORE_DENY_LIST_HEADER = "X-Cuttlefish-Ignore-Deny-List"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"X-Cuttlefish-Ignore-Deny-List: true",
"Message-ID: <1.mail>",
"Subject: Hello",
"Mime-Version: 1.0",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"To: wibble@wobble.com",
"X-Cuttlefish-Ignore-Deny-List: true",
"Message-ID: <1.mail>",
"Subject: Hello",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"From: foo@bar.com",
"To: wibble@wobble.com",
"X-Cuttlefish-Ignore-Deny-List: true",
"Message-ID: <1.mail>",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"Date: Wed, 12 Aug 2020 06:25:22 +0000",
"From: foo@bar.com",
"To: wibble@wobble.com",
"X-Cuttlefish-Ignore-Deny-List: true",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

[
"Date: Wed, 12 Aug 2020 06:25:22 +0000",
"From: foo@bar.com",
"To: wibble@wobble.com",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

@coveralls
Copy link

coveralls commented Aug 13, 2020

Coverage Status

Coverage increased (+0.1%) to 74.78% when pulling 66a705f on ignore-deny-list into 86175d6 on master.

@mlandauer mlandauer merged commit 67d3ad1 into master Aug 13, 2020
@mlandauer mlandauer deleted the ignore-deny-list branch August 13, 2020 00:39
mlandauer added a commit that referenced this pull request Aug 13, 2020
This reverts commit 67d3ad1, reversing
changes made to 86175d6.
mlandauer added a commit that referenced this pull request Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants