Merge lp://staging/~sinzui/launchpad/question-email-1 into lp://staging/launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Curtis Hovey | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 12949 | ||||
Proposed branch: | lp://staging/~sinzui/launchpad/question-email-1 | ||||
Merge into: | lp://staging/launchpad | ||||
Diff against target: |
513 lines (+308/-28) 5 files modified
lib/lp/answers/enums.py (+30/-0) lib/lp/answers/interfaces/questionjob.py (+16/-7) lib/lp/answers/model/question.py (+3/-1) lib/lp/answers/model/questionjob.py (+69/-4) lib/lp/answers/tests/test_questionjob.py (+190/-16) |
||||
To merge this branch: | bzr merge lp://staging/~sinzui/launchpad/question-email-1 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
j.c.sackett (community) | Approve | ||
Review via email:
|
Description of the change
Update QuestionJob to send emails.
Launchpad bug: https:/
Pre-
Sending email is the primary reason question pages time out. The emails can be
queued, and the Lp job process could send them. The job wants the common
message and common headers. The job will get the question recipients, build
the message by adding the recipient's reason footer and header, then send it.
This branch copies and reimplements the send email rules from
QuestionNotific
-------
RULES
Extend the basic job to do the work of sending emails to recipients
* Implement the run() method based on QuestionNotific
* Added the helper methods as used by QuestionNotific
the job does not provide them.
* Add rules to handle the four kinds of recipient sets required by
QuestionN
QA
None. This is an incremental branch for unreachable code.
LINT
lib/
lib/
lib/
lib/
lib/
TEST
./bin/test -vv -test_questionjob
IMPLEMENTATION
Testing revealed that removing the owner mutated the subscriber set, then
re-reading the code, it was clear that the question.
was mutated before the call. We want to cache/freeze the direct and indirect
recipient sets, while allowing call sites to manipulate them.
lib/
Added an enum to describe the four kinds of recipient sets that
QuestionNotific
lib/
Revised the create() because QuestionNotific
recipient set gets the email.
Added/updated run, from_address, recipients, and buildBody, all based on the
existing code from QuestionNotific
but the QuestionNotific
run() method is changed to queue().
lib/lp/
lib/lp/
lib/lp/
Looks good to land.
I have a minor quibble in a comment (that I guess I missed when reviewing your previous branch.
class IQuestionEmailJ obSource( IJobSource) :
"""An interface for acquiring IQuestionJob."""
- def create(question, user, subject, body, headers):
+ def create(question, user, recipient_set, subject, body, headers):
"""Create a new IQuestionJob.
:param question: An `IQuestion`. entSet` .
:param user: An `IPerson`.
+ :param recipient_set: A `QuestionRecipi
:param subject: A'The subject of the email.
That param should be ":param subject: The user of the email." Looks like just a minor typo.
This is *obviously* not a blocker to land. :-P