Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/conduit/PhameCreatePostConduitAPIMethod.php
| Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | protected function execute(ConduitAPIRequest $request) { | ||||
| $is_draft = $request->getValue('isDraft', false); | $is_draft = $request->getValue('isDraft', false); | ||||
| if (!$is_draft) { | if (!$is_draft) { | ||||
| $post->setDatePublished(time()); | $post->setDatePublished(time()); | ||||
| $post->setVisibility(PhamePost::VISIBILITY_PUBLISHED); | $post->setVisibility(PhamePost::VISIBILITY_PUBLISHED); | ||||
| } | } | ||||
| $post->setTitle($title); | $post->setTitle($title); | ||||
| $phame_title = $request->getValue( | $phame_title = $request->getValue( | ||||
| 'phameTitle', | 'phameTitle', | ||||
| phutil_utf8_shorten($title, 64)); | id(new PhutilUTF8StringTruncator()) | ||||
| ->setMaximumCodepoints(64) | |||||
| ->truncateString($title)); | |||||
| $post->setPhameTitle(PhabricatorSlug::normalize($phame_title)); | $post->setPhameTitle(PhabricatorSlug::normalize($phame_title)); | ||||
| $post->setBody($body); | $post->setBody($body); | ||||
| $post->save(); | $post->save(); | ||||
| return $post->toDictionary(); | return $post->toDictionary(); | ||||
| } | } | ||||
| } | } | ||||