Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97557597
PonderQuestionCreateMailReceiver.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jan 5, 06:29
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 06:29 (2 d)
Engine
blob
Format
Raw Data
Handle
23340623
Attached To
rPH Phabricator
PonderQuestionCreateMailReceiver.php
View Options
<?php
final
class
PonderQuestionCreateMailReceiver
extends
PhabricatorApplicationMailReceiver
{
protected
function
newApplication
()
{
return
new
PhabricatorPonderApplication
();
}
protected
function
processReceivedMail
(
PhabricatorMetaMTAReceivedMail
$mail
,
PhutilEmailAddress
$target
)
{
$author
=
$this
->
getAuthor
();
$title
=
$mail
->
getSubject
();
if
(!
strlen
(
$title
))
{
$title
=
pht
(
'New Question'
);
}
$xactions
=
array
();
$xactions
[]
=
id
(
new
PonderQuestionTransaction
())
->
setTransactionType
(
PonderQuestionTransaction
::
TYPE_TITLE
)
->
setNewValue
(
$title
);
$xactions
[]
=
id
(
new
PonderQuestionTransaction
())
->
setTransactionType
(
PonderQuestionTransaction
::
TYPE_CONTENT
)
->
setNewValue
(
$mail
->
getCleanTextBody
());
$question
=
PonderQuestion
::
initializeNewQuestion
(
$author
);
$content_source
=
$mail
->
newContentSource
();
$editor
=
id
(
new
PonderQuestionEditor
())
->
setActor
(
$author
)
->
setContentSource
(
$content_source
)
->
setContinueOnNoEffect
(
true
);
$xactions
=
$editor
->
applyTransactions
(
$question
,
$xactions
);
$mail
->
setRelatedPHID
(
$question
->
getPHID
());
}
}
Event Timeline
Log In to Comment