Skip to content

Commit

Permalink
Fixed logical and varnames error
Browse files Browse the repository at this point in the history
  • Loading branch information
tradzik authored and eMBee committed Feb 14, 2015
1 parent 8208642 commit 3f15516
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lib/sup/modes/reply_mode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ def initialize message, type_arg=nil
## next, cc:
cc = (@m.to + @m.cc - [from, to]).uniq

if to.full_address == "[email protected]"
to = nil
end

## one potential reply type is "reply to recipient". this only happens
## in certain cases:
## if there's no cc, then the sender is the person you want to reply
Expand All @@ -101,28 +97,30 @@ def initialize message, type_arg=nil

@headers = {}
@headers[:recipient] = {
"To" => (cc.map { |p| p.full_address == "[email protected]" ? nil : p.full_address}.compact),
"To" => (cc.map { |p| p.email == "[email protected]" ? nil : p.email}.compact),
"Cc" => [],
} if useful_recipient

## typically we don't want to have a reply-to-sender option if the sender
## is a user account. however, if the cc is empty, it's a message to
## ourselves, so for the lack of any other options, we'll add it.
@headers[:sender] = {
"To" => [to.full_address],
"Cc" => [],
} if !AccountManager.is_account?(to) && !useful_recipient && !to.full_address == "[email protected]"
if !AccountManager.is_account?(to) || !useful_recipient
@headers[:sender] = {
"To" => [to.full_address],
"Cc" => [],
} unless to.email == "[email protected]"
end

@headers[:user] = {
"To" => [],
"Cc" => [],
}

not_me_ccs = cc.select { |p| !AccountManager.is_account?(p) }
@headers[:all] = {
"To" => [to.full_address],
"Cc" => (not_me_ccs.map { |p| p.full_address == "[email protected]" ? nil : p.full_address }.compact),
} if !not_me_ccs.empty? && !to.full_address == "[email protected]"
"Cc" => (not_me_ccs.map { |p| p.email == "[email protected]" ? nil : p.email }.compact),
} unless not_me_ccs.empty? or to.email == "[email protected]"

@headers[:list] = {
"To" => [@m.list_address.full_address],
Expand Down

0 comments on commit 3f15516

Please sign in to comment.