Skip to content

Commit

Permalink
[api] change the subject of the request event mails
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Dec 16, 2013
1 parent aa37e9c commit 4fea85f
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/api/app/models/event/request.rb
Expand Up @@ -140,7 +140,7 @@ def custom_headers
end

def subject
"#{payload['who']} created request #{payload['id']} (#{actions_summary})"
"Request #{payload['id']} created by #{payload['who']} (#{actions_summary})"
end

def expanded_payload
Expand All @@ -160,7 +160,7 @@ class Event::RequestStatechange < Event::Request
receiver_roles :source_maintainer, :target_maintainer, :creator, :reviewer

def subject
"Request state of #{payload['id']} (#{actions_summary}) changed to #{payload['state']}"
"Request #{payload['id']} changed to #{payload['state']} (#{actions_summary})"
end
end

Expand All @@ -171,7 +171,7 @@ class Event::ReviewWanted < Event::Request
receiver_roles :reviewer

def subject
"Review required for request #{payload['id']} (#{actions_summary})"
"Request #{payload['id']} requires review (#{actions_summary})"
end

def expanded_payload
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/fixtures/event_mailer/request_event
@@ -1,7 +1,7 @@
From: Iggy Pop <Iggy@pop.org>
To: Thor <tschmidt@example.com>
Message-ID: obs-request-REQUESTID@localhost
Subject: Iggy created request REQUESTID (add_role home:tom)
Subject: Request REQUESTID created by Iggy (add_role home:tom)
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/fixtures/event_mailer/review_wanted
Expand Up @@ -3,7 +3,7 @@ To: Thor <tschmidt@example.com>
Message-ID: <test@localhost>
In-Reply-To: obs-request-4@localhost
References: obs-request-4@localhost
Subject: Review required for request 4 (submit Apache/BranchPack)
Subject: Request 4 requires review (submit Apache/BranchPack)
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/fixtures/event_mailer/set_bugowner_event
@@ -1,7 +1,7 @@
From: Iggy Pop <Iggy@pop.org>
To: Thor <tschmidt@example.com>
Message-ID: obs-request-REQUESTID@localhost
Subject: Iggy created request REQUESTID (set_bugowner home:tom)
Subject: Request REQUESTID created by Iggy (set_bugowner home:tom)
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/fixtures/event_mailer/tom_declined
Expand Up @@ -3,7 +3,7 @@ To: Iggy Pop <Iggy@pop.org>
message-id: test@localhost
In-Reply-To: obs-request-REQUESTID@localhost
References: obs-request-REQUESTID@localhost
Subject: Request state of REQUESTID (set_bugowner home:tom) changed to declined
Subject: Request REQUESTID changed to declined (set_bugowner home:tom)
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/fixtures/event_mailer/tom_gets_mail_too
Expand Up @@ -3,7 +3,7 @@ To: Johnny Thunders <adrian@example.com>,
Frederic Feuerstone <fred@feuerstein.de>,
Thor <tschmidt@example.com>
message-id: test@localhost
Subject: Iggy created request REQUESTID (add_role kde4/kdelibs)
Subject: Request REQUESTID created by Iggy (add_role kde4/kdelibs)
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Expand Down
10 changes: 5 additions & 5 deletions src/api/test/functional/request_events_test.rb
Expand Up @@ -31,7 +31,7 @@ def verify_email(fixture_name, myid, email)

email = ActionMailer::Base.deliveries.last

assert_equal "Iggy created request #{myid} (add_role home:tom)", email.subject
assert_equal "Request #{myid} created by Iggy (add_role home:tom)", email.subject
assert_equal %w(tschmidt@example.com), email.to # tom is maintainer
verify_email('request_event', myid, email)
end
Expand All @@ -49,7 +49,7 @@ def verify_email(fixture_name, myid, email)

email = ActionMailer::Base.deliveries.last

assert_equal "Iggy created request #{myid} (set_bugowner home:tom)", email.subject
assert_equal "Request #{myid} created by Iggy (set_bugowner home:tom)", email.subject
assert_equal %w(tschmidt@example.com), email.to
verify_email('set_bugowner_event', myid, email)

Expand All @@ -68,7 +68,7 @@ def verify_email(fixture_name, myid, email)
end

email.message_id = 'test@localhost' # easier to compare :)
assert_equal "Request state of #{myid} (set_bugowner home:tom) changed to declined", email.subject
assert_equal "Request #{myid} changed to declined (set_bugowner home:tom)", email.subject
verify_email('tom_declined', myid, email)
end

Expand All @@ -85,7 +85,7 @@ def verify_email(fixture_name, myid, email)

email = ActionMailer::Base.deliveries.last

assert_equal "Review required for request #{myid} (submit Apache/BranchPack)", email.subject
assert_equal "Request #{myid} requires review (submit Apache/BranchPack)", email.subject
assert_equal %w(adrian@example.com), email.to
end

Expand Down Expand Up @@ -124,4 +124,4 @@ def verify_email(fixture_name, myid, email)
verify_email('tom_gets_mail_too', myid, email)
end

end
end
2 changes: 1 addition & 1 deletion src/api/test/models/event_test.rb
Expand Up @@ -73,7 +73,7 @@ def users_for_event(e)
end
email = ActionMailer::Base.deliveries.last

assert_equal "Review required for request #{myid} (submit Apache/BranchPack)", email.subject
assert_equal "Request #{myid} requires review (submit Apache/BranchPack)", email.subject
assert_equal %w(tschmidt@example.com), email.to
should = load_fixture('event_mailer/review_wanted').gsub('REQUESTID', myid.to_s).chomp
email.message_id = '<test@localhost>'
Expand Down

0 comments on commit 4fea85f

Please sign in to comment.