@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Conpherence - fix a few bugs

Summary: fixes the "click edit and it clears title" bug. fixes a "upload the same image again and I get nothing" bug by making the create file codepath also copy dimensions if the file already exists, rather than making a copy sans dimensions. fixes the "title is so long it breaks the widget" bug by truncating the text AND adding some CSS to prevent it from happening.

Test Plan: messed around with a conpherence. changed the title, changed the picture, changed the crop and all worked. uploaded some long file names and verified they were truncated nicely.

Reviewers: epriestley, chad

Reviewed By: chad

CC: aran, Korvin

Maniphest Tasks: T2399

Differential Revision: https://secure.phabricator.com/D5378

+28 -4
+10 -3
src/applications/conpherence/controller/ConpherenceUpdateController.php
··· 77 77 $xactions[] = id(new ConpherenceTransaction()) 78 78 ->setTransactionType(ConpherenceTransactionType::TYPE_PICTURE) 79 79 ->setNewValue($orig_file->getPHID()); 80 - // do 2 transformations "crudely" 80 + // do a transformation "crudely" 81 81 $xformer = new PhabricatorImageTransformer(); 82 82 $header_file = $xformer->executeConpherenceTransform( 83 83 $orig_file, ··· 105 105 $title = $conpherence->getTitle(); 106 106 $updated = true; 107 107 $fancy_ajax_style = false; 108 - } else if ($top !== null || $left !== null) { 108 + } 109 + 110 + // all other metadata updates are continue requests 111 + if (!$request->isContinueRequest()) { 112 + break; 113 + } 114 + 115 + if ($top !== null || $left !== null) { 109 116 $file = $conpherence->getImage(ConpherenceImageData::SIZE_ORIG); 110 117 $xformer = new PhabricatorImageTransformer(); 111 118 $xformed = $xformer->executeConpherenceTransform( ··· 128 135 ->setNewValue($title); 129 136 $updated = true; 130 137 } 131 - if (!$updated && $request->isContinueRequest()) { 138 + if (!$updated) { 132 139 $errors[] = pht( 133 140 'That was a non-update. Try cancel.'); 134 141 }
+1 -1
src/applications/conpherence/view/ConpherenceFileWidgetView.php
··· 39 39 ''); 40 40 $file_view = id(new PhabricatorFileLinkView()) 41 41 ->setFilePHID($file->getPHID()) 42 - ->setFileName($file->getName()) 42 + ->setFileName(phutil_utf8_shorten($file->getName(), 38)) 43 43 ->setFileViewable($file->isViewableImage()) 44 44 ->setFileViewURI($file->getBestURI()) 45 45 ->setCustomClass('file-title');
+15
src/applications/files/storage/PhabricatorFile.php
··· 165 165 $new_file->setStorageHandle($copy_of_storage_handle); 166 166 $new_file->setStorageFormat($copy_of_storage_format); 167 167 $new_file->setMimeType($copy_of_mimeType); 168 + $new_file->copyDimensions($file); 168 169 169 170 $new_file->save(); 170 171 ··· 631 632 632 633 if ($save) { 633 634 $this->save(); 635 + } 636 + 637 + return $this; 638 + } 639 + 640 + public function copyDimensions(PhabricatorFile $file) { 641 + $metadata = $file->getMetadata(); 642 + $width = idx($metadata, self::METADATA_IMAGE_WIDTH); 643 + if ($width) { 644 + $this->metadata[self::METADATA_IMAGE_WIDTH] = $width; 645 + } 646 + $height = idx($metadata, self::METADATA_IMAGE_HEIGHT); 647 + if ($height) { 648 + $this->metadata[self::METADATA_IMAGE_HEIGHT] = $height; 634 649 } 635 650 636 651 return $this;
+2
webroot/rsrc/css/application/conpherence/widget-pane.css
··· 87 87 position: relative; 88 88 top: -4px; 89 89 left: 20px; 90 + overflow-x: hidden; 91 + width: 270px; 90 92 font-weight: bold; 91 93 } 92 94 .conpherence-widget-pane #widgets-files .file-uploaded-by {