Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61071353
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
Sat, May 4, 08:44
Size
1 KB
Mime Type
text/x-php
Expires
Mon, May 6, 08:44 (2 d)
Engine
blob
Format
Raw Data
Handle
17461028
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