1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

Fix missing file attachment in Conpherence

Summary:
When you drag and drop a file in a Conpherence chat,
the file was only visible by the author.

Now the file is also attached to that chat, making it visible.

This is a follow-up from:

https://we.phorge.it/D25705?id=2178

Refs T15106

Test Plan:
1) open a Conpherence chat or create a new one
2) drag and drop file in it and send the message
3) verify file is attached to the chat

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: avivey, Cigaryno, Matthew, valerio.bozzolan, tobiaswiese

Maniphest Tasks: T15106

Differential Revision: https://we.phorge.it/D25709
This commit is contained in:
Merula Turdus 2024-07-05 17:46:52 +02:00
parent b0bba4d142
commit 136091ecd0
2 changed files with 39 additions and 0 deletions

View file

@ -79,6 +79,30 @@ final class ConpherenceUpdateController
$user,
$conpherence,
$message);
$xaction_comment = PhabricatorTransactions::findOneByType(
$xactions,
PhabricatorTransactions::TYPE_COMMENT);
$text_metadata = $request->getStr('text_metadata');
if ($text_metadata) {
$text_metadata = phutil_json_decode($text_metadata);
$attached_file_phids = idx(
$text_metadata,
'attachedFilePHIDs',
array());
if ($attached_file_phids) {
$metadata_object = array(
'remarkup.control' => array(
'attachedFilePHIDs' => $attached_file_phids,
),
);
$xaction_comment->setMetadata($metadata_object);
}
}
$delete_draft = true;
} else {
$action = ConpherenceUpdateActions::LOAD;

View file

@ -41,4 +41,19 @@ final class PhabricatorTransactions extends Phobject {
);
}
/**
* Find the first transaction that matches a type.
* @param array $xactions
* @param string $type
* @return PhabricatorTransactions|null
*/
public static function findOneByType($xactions, $type) {
foreach ($xactions as $xaction) {
if ($xaction->getTransactionType() === $type) {
return $xaction;
}
}
return null;
}
}