Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14390605
D16217.id39011.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D16217.id39011.diff
View Options
diff --git a/src/applications/phame/controller/blog/PhameBlogHeaderPictureController.php b/src/applications/phame/controller/blog/PhameBlogHeaderPictureController.php
--- a/src/applications/phame/controller/blog/PhameBlogHeaderPictureController.php
+++ b/src/applications/phame/controller/blog/PhameBlogHeaderPictureController.php
@@ -53,12 +53,25 @@
if (!$errors) {
if ($delete_header) {
- $blog->setHeaderImagePHID(null);
+ $new_value = null;
} else {
- $blog->setHeaderImagePHID($file->getPHID());
$file->attachToObject($blog->getPHID());
+ $new_value = $file->getPHID();
}
- $blog->save();
+
+ $xactions = array();
+ $xactions[] = id(new PhameBlogTransaction())
+ ->setTransactionType(PhameBlogTransaction::TYPE_HEADERIMAGE)
+ ->setNewValue($new_value);
+
+ $editor = id(new PhameBlogEditor())
+ ->setActor($viewer)
+ ->setContentSourceFromRequest($request)
+ ->setContinueOnMissingFields(true)
+ ->setContinueOnNoEffect(true);
+
+ $editor->applyTransactions($blog, $xactions);
+
return id(new AphrontRedirectResponse())->setURI($blog_uri);
}
}
diff --git a/src/applications/phame/controller/blog/PhameBlogProfilePictureController.php b/src/applications/phame/controller/blog/PhameBlogProfilePictureController.php
--- a/src/applications/phame/controller/blog/PhameBlogProfilePictureController.php
+++ b/src/applications/phame/controller/blog/PhameBlogProfilePictureController.php
@@ -68,12 +68,25 @@
if (!$errors) {
if ($is_default) {
- $blog->setProfileImagePHID(null);
+ $new_value = null;
} else {
- $blog->setProfileImagePHID($xformed->getPHID());
$xformed->attachToObject($blog->getPHID());
+ $new_value = $xformed->getPHID();
}
- $blog->save();
+
+ $xactions = array();
+ $xactions[] = id(new PhameBlogTransaction())
+ ->setTransactionType(PhameBlogTransaction::TYPE_PROFILEIMAGE)
+ ->setNewValue($new_value);
+
+ $editor = id(new PhameBlogEditor())
+ ->setActor($viewer)
+ ->setContentSourceFromRequest($request)
+ ->setContinueOnMissingFields(true)
+ ->setContinueOnNoEffect(true);
+
+ $editor->applyTransactions($blog, $xactions);
+
return id(new AphrontRedirectResponse())->setURI($blog_uri);
}
}
diff --git a/src/applications/phame/editor/PhameBlogEditor.php b/src/applications/phame/editor/PhameBlogEditor.php
--- a/src/applications/phame/editor/PhameBlogEditor.php
+++ b/src/applications/phame/editor/PhameBlogEditor.php
@@ -21,6 +21,9 @@
$types[] = PhameBlogTransaction::TYPE_PARENTSITE;
$types[] = PhameBlogTransaction::TYPE_PARENTDOMAIN;
$types[] = PhameBlogTransaction::TYPE_STATUS;
+ $types[] = PhameBlogTransaction::TYPE_HEADERIMAGE;
+ $types[] = PhameBlogTransaction::TYPE_PROFILEIMAGE;
+
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
@@ -44,6 +47,10 @@
return $object->getParentSite();
case PhameBlogTransaction::TYPE_PARENTDOMAIN:
return $object->getParentDomain();
+ case PhameBlogTransaction::TYPE_PROFILEIMAGE:
+ return $object->getProfileImagePHID();
+ case PhameBlogTransaction::TYPE_HEADERIMAGE:
+ return $object->getHeaderImagePHID();
case PhameBlogTransaction::TYPE_STATUS:
return $object->getStatus();
}
@@ -59,7 +66,8 @@
case PhameBlogTransaction::TYPE_DESCRIPTION:
case PhameBlogTransaction::TYPE_STATUS:
case PhameBlogTransaction::TYPE_PARENTSITE:
- case PhameBlogTransaction::TYPE_PARENTDOMAIN:
+ case PhameBlogTransaction::TYPE_PROFILEIMAGE:
+ case PhameBlogTransaction::TYPE_HEADERIMAGE:
return $xaction->getNewValue();
case PhameBlogTransaction::TYPE_FULLDOMAIN:
$domain = $xaction->getNewValue();
@@ -92,6 +100,10 @@
}
$object->setDomainFullURI($new_value);
return;
+ case PhameBlogTransaction::TYPE_PROFILEIMAGE:
+ return $object->setProfileImagePHID($xaction->getNewValue());
+ case PhameBlogTransaction::TYPE_HEADERIMAGE:
+ return $object->setHeaderImagePHID($xaction->getNewValue());
case PhameBlogTransaction::TYPE_STATUS:
return $object->setStatus($xaction->getNewValue());
case PhameBlogTransaction::TYPE_PARENTSITE:
@@ -114,6 +126,8 @@
case PhameBlogTransaction::TYPE_FULLDOMAIN:
case PhameBlogTransaction::TYPE_PARENTSITE:
case PhameBlogTransaction::TYPE_PARENTDOMAIN:
+ case PhameBlogTransaction::TYPE_HEADERIMAGE:
+ case PhameBlogTransaction::TYPE_PROFILEIMAGE:
case PhameBlogTransaction::TYPE_STATUS:
return;
}
diff --git a/src/applications/phame/storage/PhameBlogTransaction.php b/src/applications/phame/storage/PhameBlogTransaction.php
--- a/src/applications/phame/storage/PhameBlogTransaction.php
+++ b/src/applications/phame/storage/PhameBlogTransaction.php
@@ -3,13 +3,15 @@
final class PhameBlogTransaction
extends PhabricatorApplicationTransaction {
- const TYPE_NAME = 'phame.blog.name';
- const TYPE_SUBTITLE = 'phame.blog.subtitle';
- const TYPE_DESCRIPTION = 'phame.blog.description';
- const TYPE_FULLDOMAIN = 'phame.blog.full.domain';
- const TYPE_STATUS = 'phame.blog.status';
- const TYPE_PARENTSITE = 'phame.blog.parent.site';
- const TYPE_PARENTDOMAIN = 'phame.blog.parent.domain';
+ const TYPE_NAME = 'phame.blog.name';
+ const TYPE_SUBTITLE = 'phame.blog.subtitle';
+ const TYPE_DESCRIPTION = 'phame.blog.description';
+ const TYPE_FULLDOMAIN = 'phame.blog.full.domain';
+ const TYPE_STATUS = 'phame.blog.status';
+ const TYPE_PARENTSITE = 'phame.blog.parent.site';
+ const TYPE_PARENTDOMAIN = 'phame.blog.parent.domain';
+ const TYPE_PROFILEIMAGE = 'phame.blog.header.image';
+ const TYPE_HEADERIMAGE = 'phame.blog.profile.image';
const MAILTAG_DETAILS = 'phame-blog-details';
const MAILTAG_SUBSCRIBERS = 'phame-blog-subscribers';
@@ -48,6 +50,9 @@
case self::TYPE_DESCRIPTION:
case self::TYPE_FULLDOMAIN:
return 'fa-pencil';
+ case self::TYPE_HEADERIMAGE:
+ case self::TYPE_PROFILEIMAGE:
+ return 'fa-image';
case self::TYPE_STATUS:
if ($new == PhameBlog::STATUS_ARCHIVED) {
return 'fa-ban';
@@ -88,6 +93,8 @@
case self::TYPE_FULLDOMAIN:
case self::TYPE_PARENTSITE:
case self::TYPE_PARENTDOMAIN:
+ case self::TYPE_PROFILEIMAGE:
+ case self::TYPE_HEADERIMAGE:
$tags[] = self::MAILTAG_DETAILS;
break;
default:
@@ -172,6 +179,18 @@
$new);
}
break;
+ case self::TYPE_HEADERIMAGE:
+ return pht(
+ '%s set this blog\'s header image to "%s".',
+ $this->renderHandleLink($author_phid),
+ $new);
+ break;
+ case self::TYPE_PROFILEIMAGE:
+ return pht(
+ '%s set this blog\'s profile image to "%s".',
+ $this->renderHandleLink($author_phid),
+ $new);
+ break;
case self::TYPE_STATUS:
switch ($new) {
case PhameBlog::STATUS_ACTIVE:
@@ -248,6 +267,18 @@
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
+ case self::TYPE_HEADERIMAGE:
+ return pht(
+ '%s updated the header image for %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid));
+ break;
+ case self::TYPE_PROFILEIMAGE:
+ return pht(
+ '%s updated the profile image for %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid));
+ break;
case self::TYPE_STATUS:
switch ($new) {
case PhameBlog::STATUS_ACTIVE:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 6:48 PM (13 h, 40 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6919399
Default Alt Text
D16217.id39011.diff (7 KB)
Attached To
Mode
D16217: Make Phame Header and Profile Image Transactional
Attached
Detach File
Event Timeline
Log In to Comment