Page MenuHomePhorge

D25475.1734694794.diff
No OneTemporary

D25475.1734694794.diff

diff --git a/src/applications/project/controller/PhabricatorProjectCoverController.php b/src/applications/project/controller/PhabricatorProjectCoverController.php
--- a/src/applications/project/controller/PhabricatorProjectCoverController.php
+++ b/src/applications/project/controller/PhabricatorProjectCoverController.php
@@ -35,10 +35,42 @@
$xactions = array();
+ // Set the Image Cover.
$xactions[] = id(new ManiphestTransaction())
->setTransactionType(ManiphestTaskCoverImageTransaction::TRANSACTIONTYPE)
->setNewValue($file->getPHID());
+ // Attach the Cover Image to the Task.
+ // Base case: handling a new file (supported):
+ // If you are the author of the new File, that File is probably private
+ // as default, so, you attach, to make it visible to Task participants.
+ // Future case: already-existing file (currently unsupported):
+ // If you are the author of an already-existing file, that may be
+ // already attached to this Object.
+ // This is currently not supported from the UX but may be supported
+ // later, checking for potential errors related to double-attach.
+ // Unknown future cases:
+ // A non-author may want to attach a semi-private already-existing file
+ // to make it somehow "more visible" than before without authorization
+ // from the original author.
+ // It is probably quite foolish to try to prevent this kind of things,
+ // since, if you can see something, indeed you can copy-pasta that.
+ // Anyway, since this use-case is unknown,
+ // we are a bit strict, requiring to be the author of that file,
+ // before sharing that as Task cover image.
+ // If you want to support this, and omit this check, join the Task :)
+ // https://we.phorge.it/T15163
+ if ($file->getAuthorPHID() === $viewer->getPHID()) {
+ $template = $object->getApplicationTransactionTemplate();
+ $attach_mode = PhabricatorFileAttachment::MODE_ATTACH;
+ $xactions[] = id(clone $template)
+ ->setTransactionType(PhabricatorTransactions::TYPE_FILE)
+ ->setNewValue(
+ array(
+ $file_phid => $attach_mode,
+ ));
+ }
+
$editor = id(new ManiphestTransactionEditor())
->setActor($viewer)
->setContinueOnMissingFields(true)

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 11:39 (11 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1017450
Default Alt Text
D25475.1734694794.diff (2 KB)

Event Timeline