1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-15 01:50:55 +01:00

(stable) Promote 2017 Week 50

This commit is contained in:
epriestley 2017-12-18 09:55:44 -08:00
commit 25536d0d47
20 changed files with 303 additions and 21 deletions

View file

@ -80,7 +80,7 @@ return array(
'rsrc/css/application/flag/flag.css' => 'bba8f811', 'rsrc/css/application/flag/flag.css' => 'bba8f811',
'rsrc/css/application/harbormaster/harbormaster.css' => 'f491c9f4', 'rsrc/css/application/harbormaster/harbormaster.css' => 'f491c9f4',
'rsrc/css/application/herald/herald-test.css' => 'a52e323e', 'rsrc/css/application/herald/herald-test.css' => 'a52e323e',
'rsrc/css/application/herald/herald.css' => 'dc31f6e9', 'rsrc/css/application/herald/herald.css' => 'cd8d0134',
'rsrc/css/application/maniphest/batch-editor.css' => 'b0f0b6d5', 'rsrc/css/application/maniphest/batch-editor.css' => 'b0f0b6d5',
'rsrc/css/application/maniphest/report.css' => '9b9580b7', 'rsrc/css/application/maniphest/report.css' => '9b9580b7',
'rsrc/css/application/maniphest/task-edit.css' => 'fda62a9b', 'rsrc/css/application/maniphest/task-edit.css' => 'fda62a9b',
@ -416,7 +416,7 @@ return array(
'rsrc/js/application/drydock/drydock-live-operation-status.js' => '901935ef', 'rsrc/js/application/drydock/drydock-live-operation-status.js' => '901935ef',
'rsrc/js/application/files/behavior-icon-composer.js' => '8499b6ab', 'rsrc/js/application/files/behavior-icon-composer.js' => '8499b6ab',
'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888', 'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888',
'rsrc/js/application/herald/HeraldRuleEditor.js' => 'd6a7e717', 'rsrc/js/application/herald/HeraldRuleEditor.js' => '2dff5579',
'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec', 'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec',
'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3', 'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3',
'rsrc/js/application/maniphest/behavior-batch-editor.js' => '782ab6e7', 'rsrc/js/application/maniphest/behavior-batch-editor.js' => '782ab6e7',
@ -578,8 +578,8 @@ return array(
'font-lato' => 'c7ccd872', 'font-lato' => 'c7ccd872',
'global-drag-and-drop-css' => 'b556a948', 'global-drag-and-drop-css' => 'b556a948',
'harbormaster-css' => 'f491c9f4', 'harbormaster-css' => 'f491c9f4',
'herald-css' => 'dc31f6e9', 'herald-css' => 'cd8d0134',
'herald-rule-editor' => 'd6a7e717', 'herald-rule-editor' => '2dff5579',
'herald-test-css' => 'a52e323e', 'herald-test-css' => 'a52e323e',
'inline-comment-summary-css' => 'f23d4e8f', 'inline-comment-summary-css' => 'f23d4e8f',
'javelin-aphlict' => 'e1d4b11a', 'javelin-aphlict' => 'e1d4b11a',
@ -1106,6 +1106,15 @@ return array(
'javelin-install', 'javelin-install',
'javelin-event', 'javelin-event',
), ),
'2dff5579' => array(
'multirow-row-manager',
'javelin-install',
'javelin-util',
'javelin-dom',
'javelin-stratcom',
'javelin-json',
'phabricator-prefab',
),
'2ee659ce' => array( '2ee659ce' => array(
'javelin-install', 'javelin-install',
), ),
@ -2001,15 +2010,6 @@ return array(
'javelin-dom', 'javelin-dom',
'javelin-stratcom', 'javelin-stratcom',
), ),
'd6a7e717' => array(
'multirow-row-manager',
'javelin-install',
'javelin-util',
'javelin-dom',
'javelin-stratcom',
'javelin-json',
'phabricator-prefab',
),
'd7a74243' => array( 'd7a74243' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-stratcom', 'javelin-stratcom',

View file

@ -821,6 +821,7 @@ phutil_register_library_map(array(
'DiffusionPreCommitRefRepositoryHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitRefRepositoryHeraldField.php', 'DiffusionPreCommitRefRepositoryHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitRefRepositoryHeraldField.php',
'DiffusionPreCommitRefRepositoryProjectsHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitRefRepositoryProjectsHeraldField.php', 'DiffusionPreCommitRefRepositoryProjectsHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitRefRepositoryProjectsHeraldField.php',
'DiffusionPreCommitRefTypeHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitRefTypeHeraldField.php', 'DiffusionPreCommitRefTypeHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitRefTypeHeraldField.php',
'DiffusionPreCommitUsesGitLFSHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitUsesGitLFSHeraldField.php',
'DiffusionPullEventGarbageCollector' => 'applications/diffusion/garbagecollector/DiffusionPullEventGarbageCollector.php', 'DiffusionPullEventGarbageCollector' => 'applications/diffusion/garbagecollector/DiffusionPullEventGarbageCollector.php',
'DiffusionPushCapability' => 'applications/diffusion/capability/DiffusionPushCapability.php', 'DiffusionPushCapability' => 'applications/diffusion/capability/DiffusionPushCapability.php',
'DiffusionPushEventViewController' => 'applications/diffusion/controller/DiffusionPushEventViewController.php', 'DiffusionPushEventViewController' => 'applications/diffusion/controller/DiffusionPushEventViewController.php',
@ -1337,6 +1338,7 @@ phutil_register_library_map(array(
'HeraldApplyTranscript' => 'applications/herald/storage/transcript/HeraldApplyTranscript.php', 'HeraldApplyTranscript' => 'applications/herald/storage/transcript/HeraldApplyTranscript.php',
'HeraldBasicFieldGroup' => 'applications/herald/field/HeraldBasicFieldGroup.php', 'HeraldBasicFieldGroup' => 'applications/herald/field/HeraldBasicFieldGroup.php',
'HeraldBuildableState' => 'applications/herald/state/HeraldBuildableState.php', 'HeraldBuildableState' => 'applications/herald/state/HeraldBuildableState.php',
'HeraldCommentAction' => 'applications/herald/action/HeraldCommentAction.php',
'HeraldCommitAdapter' => 'applications/diffusion/herald/HeraldCommitAdapter.php', 'HeraldCommitAdapter' => 'applications/diffusion/herald/HeraldCommitAdapter.php',
'HeraldCondition' => 'applications/herald/storage/HeraldCondition.php', 'HeraldCondition' => 'applications/herald/storage/HeraldCondition.php',
'HeraldConditionTranscript' => 'applications/herald/storage/transcript/HeraldConditionTranscript.php', 'HeraldConditionTranscript' => 'applications/herald/storage/transcript/HeraldConditionTranscript.php',
@ -1378,6 +1380,7 @@ phutil_register_library_map(array(
'HeraldProjectsField' => 'applications/project/herald/HeraldProjectsField.php', 'HeraldProjectsField' => 'applications/project/herald/HeraldProjectsField.php',
'HeraldRecursiveConditionsException' => 'applications/herald/engine/exception/HeraldRecursiveConditionsException.php', 'HeraldRecursiveConditionsException' => 'applications/herald/engine/exception/HeraldRecursiveConditionsException.php',
'HeraldRelatedFieldGroup' => 'applications/herald/field/HeraldRelatedFieldGroup.php', 'HeraldRelatedFieldGroup' => 'applications/herald/field/HeraldRelatedFieldGroup.php',
'HeraldRemarkupFieldValue' => 'applications/herald/value/HeraldRemarkupFieldValue.php',
'HeraldRemarkupRule' => 'applications/herald/remarkup/HeraldRemarkupRule.php', 'HeraldRemarkupRule' => 'applications/herald/remarkup/HeraldRemarkupRule.php',
'HeraldRepetitionPolicyConfig' => 'applications/herald/config/HeraldRepetitionPolicyConfig.php', 'HeraldRepetitionPolicyConfig' => 'applications/herald/config/HeraldRepetitionPolicyConfig.php',
'HeraldRule' => 'applications/herald/storage/HeraldRule.php', 'HeraldRule' => 'applications/herald/storage/HeraldRule.php',
@ -5879,6 +5882,7 @@ phutil_register_library_map(array(
'DiffusionPreCommitRefRepositoryHeraldField' => 'DiffusionPreCommitRefHeraldField', 'DiffusionPreCommitRefRepositoryHeraldField' => 'DiffusionPreCommitRefHeraldField',
'DiffusionPreCommitRefRepositoryProjectsHeraldField' => 'DiffusionPreCommitRefHeraldField', 'DiffusionPreCommitRefRepositoryProjectsHeraldField' => 'DiffusionPreCommitRefHeraldField',
'DiffusionPreCommitRefTypeHeraldField' => 'DiffusionPreCommitRefHeraldField', 'DiffusionPreCommitRefTypeHeraldField' => 'DiffusionPreCommitRefHeraldField',
'DiffusionPreCommitUsesGitLFSHeraldField' => 'DiffusionPreCommitContentHeraldField',
'DiffusionPullEventGarbageCollector' => 'PhabricatorGarbageCollector', 'DiffusionPullEventGarbageCollector' => 'PhabricatorGarbageCollector',
'DiffusionPushCapability' => 'PhabricatorPolicyCapability', 'DiffusionPushCapability' => 'PhabricatorPolicyCapability',
'DiffusionPushEventViewController' => 'DiffusionPushLogController', 'DiffusionPushEventViewController' => 'DiffusionPushLogController',
@ -6488,6 +6492,7 @@ phutil_register_library_map(array(
'HeraldApplyTranscript' => 'Phobject', 'HeraldApplyTranscript' => 'Phobject',
'HeraldBasicFieldGroup' => 'HeraldFieldGroup', 'HeraldBasicFieldGroup' => 'HeraldFieldGroup',
'HeraldBuildableState' => 'HeraldState', 'HeraldBuildableState' => 'HeraldState',
'HeraldCommentAction' => 'HeraldAction',
'HeraldCommitAdapter' => array( 'HeraldCommitAdapter' => array(
'HeraldAdapter', 'HeraldAdapter',
'HarbormasterBuildableAdapterInterface', 'HarbormasterBuildableAdapterInterface',
@ -6535,6 +6540,7 @@ phutil_register_library_map(array(
'HeraldProjectsField' => 'HeraldField', 'HeraldProjectsField' => 'HeraldField',
'HeraldRecursiveConditionsException' => 'Exception', 'HeraldRecursiveConditionsException' => 'Exception',
'HeraldRelatedFieldGroup' => 'HeraldFieldGroup', 'HeraldRelatedFieldGroup' => 'HeraldFieldGroup',
'HeraldRemarkupFieldValue' => 'HeraldFieldValue',
'HeraldRemarkupRule' => 'PhabricatorObjectRemarkupRule', 'HeraldRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'HeraldRepetitionPolicyConfig' => 'Phobject', 'HeraldRepetitionPolicyConfig' => 'Phobject',
'HeraldRule' => array( 'HeraldRule' => array(

View file

@ -132,12 +132,14 @@ final class DifferentialTransactionEditor
$diff = $this->requireDiff($xaction->getNewValue()); $diff = $this->requireDiff($xaction->getNewValue());
$object->setLineCount($diff->getLineCount()); $this->updateRevisionLineCounts($object, $diff);
if ($this->repositoryPHIDOverride !== false) { if ($this->repositoryPHIDOverride !== false) {
$object->setRepositoryPHID($this->repositoryPHIDOverride); $object->setRepositoryPHID($this->repositoryPHIDOverride);
} else { } else {
$object->setRepositoryPHID($diff->getRepositoryPHID()); $object->setRepositoryPHID($diff->getRepositoryPHID());
} }
$object->attachActiveDiff($diff); $object->attachActiveDiff($diff);
$object->setActiveDiffPHID($diff->getPHID()); $object->setActiveDiffPHID($diff->getPHID());
return; return;
@ -1645,5 +1647,25 @@ final class DifferentialTransactionEditor
return true; return true;
} }
private function updateRevisionLineCounts(
DifferentialRevision $revision,
DifferentialDiff $diff) {
$revision->setLineCount($diff->getLineCount());
$conn = $revision->establishConnection('r');
$row = queryfx_one(
$conn,
'SELECT SUM(addLines) A, SUM(delLines) D FROM %T
WHERE diffID = %d',
id(new DifferentialChangeset())->getTableName(),
$diff->getID());
if ($row) {
$revision->setAddedLineCount((int)$row['A']);
$revision->setRemovedLineCount((int)$row['D']);
}
}
} }

View file

@ -61,6 +61,8 @@ final class DifferentialRevision extends DifferentialDAO
const PROPERTY_CLOSED_FROM_ACCEPTED = 'wasAcceptedBeforeClose'; const PROPERTY_CLOSED_FROM_ACCEPTED = 'wasAcceptedBeforeClose';
const PROPERTY_DRAFT_HOLD = 'draft.hold'; const PROPERTY_DRAFT_HOLD = 'draft.hold';
const PROPERTY_HAS_BROADCAST = 'draft.broadcast'; const PROPERTY_HAS_BROADCAST = 'draft.broadcast';
const PROPERTY_LINES_ADDED = 'lines.added';
const PROPERTY_LINES_REMOVED = 'lines.removed';
public static function initializeNewRevision(PhabricatorUser $actor) { public static function initializeNewRevision(PhabricatorUser $actor) {
$app = id(new PhabricatorApplicationQuery()) $app = id(new PhabricatorApplicationQuery())
@ -728,6 +730,21 @@ final class DifferentialRevision extends DifferentialDAO
return $this->setProperty(self::PROPERTY_HAS_BROADCAST, $has_broadcast); return $this->setProperty(self::PROPERTY_HAS_BROADCAST, $has_broadcast);
} }
public function setAddedLineCount($count) {
return $this->setProperty(self::PROPERTY_LINES_ADDED, $count);
}
public function getAddedLineCount() {
return $this->getProperty(self::PROPERTY_LINES_ADDED);
}
public function setRemovedLineCount($count) {
return $this->setProperty(self::PROPERTY_LINES_REMOVED, $count);
}
public function getRemovedLineCount() {
return $this->getProperty(self::PROPERTY_LINES_REMOVED);
}
public function loadActiveBuilds(PhabricatorUser $viewer) { public function loadActiveBuilds(PhabricatorUser $viewer) {
$diff = $this->getActiveDiff(); $diff = $this->getActiveDiff();

View file

@ -52,6 +52,36 @@ final class DiffusionBrowseQueryConduitAPIMethod
$commit, $commit,
$path); $path);
} catch (CommandException $e) { } catch (CommandException $e) {
// The "cat-file" command may fail if the path legitimately does not
// exist, but it may also fail if the path is a submodule. This can
// produce either "Not a valid object name" or "could not get object
// info".
// To detect if we have a submodule, use `git ls-tree`. If the path
// is a submodule, we'll get a "160000" mode mask with type "commit".
list($sub_err, $sub_stdout) = $repository->execLocalCommand(
'ls-tree %s -- %s',
$commit,
$path);
if (!$sub_err) {
// If the path failed "cat-file" but "ls-tree" worked, we assume it
// must be a submodule. If it is, the output will look something
// like this:
//
// 160000 commit <hash> <path>
//
// We make sure it has the 160000 mode mask to confirm that it's
// definitely a submodule.
$mode = (int)$sub_stdout;
if ($mode & 160000) {
$submodule_reason = DiffusionBrowseResultSet::REASON_IS_SUBMODULE;
$result
->setReasonForEmptyResultSet($submodule_reason);
return $result;
}
}
$stderr = $e->getStderr(); $stderr = $e->getStderr();
if (preg_match('/^fatal: Not a valid object name/', $stderr)) { if (preg_match('/^fatal: Not a valid object name/', $stderr)) {
// Grab two logs, since the first one is when the object was deleted. // Grab two logs, since the first one is when the object was deleted.

View file

@ -101,7 +101,7 @@ final class PhabricatorDiffusionConfigOptions
->setBoolOptions( ->setBoolOptions(
array( array(
pht('Allow HTTP Basic Auth'), pht('Allow HTTP Basic Auth'),
pht('Disable HTTP Basic Auth'), pht('Disallow HTTP Basic Auth'),
)) ))
->setSummary(pht('Enable HTTP Basic Auth for repositories.')) ->setSummary(pht('Enable HTTP Basic Auth for repositories.'))
->setDescription( ->setDescription(
@ -115,6 +115,19 @@ final class PhabricatorDiffusionConfigOptions
"barrier to attackers than SSH does.\n\n". "barrier to attackers than SSH does.\n\n".
"Consider using SSH for authenticated access to repositories ". "Consider using SSH for authenticated access to repositories ".
"instead of HTTP.")), "instead of HTTP.")),
$this->newOption('diffusion.allow-git-lfs', 'bool', false)
->setBoolOptions(
array(
pht('Allow Git LFS'),
pht('Disallow Git LFS'),
))
->setLocked(true)
->setSummary(pht('Allow Git Large File Storage (LFS).'))
->setDescription(
pht(
'Phabricator supports Git LFS, a Git extension for storing large '.
'files alongside a repository. Activate this setting to allow '.
'the extension to store file data in Phabricator.')),
$this->newOption('diffusion.ssh-user', 'string', null) $this->newOption('diffusion.ssh-user', 'string', null)
->setLocked(true) ->setLocked(true)
->setSummary(pht('Login username for SSH connections to repositories.')) ->setSummary(pht('Login username for SSH connections to repositories.'))

View file

@ -916,7 +916,8 @@ final class DiffusionBrowseController extends DiffusionController {
->setTag('a') ->setTag('a')
->setText($text) ->setText($text)
->setHref($href) ->setHref($href)
->setIcon($icon); ->setIcon($icon)
->setColor(PHUIButtonView::GREY);
} }
private function buildDisplayRows( private function buildDisplayRows(
@ -1924,7 +1925,7 @@ final class DiffusionBrowseController extends DiffusionController {
try { try {
$file = $this->loadGitLFSFile($ref); $file = $this->loadGitLFSFile($ref);
$data = $this->renderGitLFSButton(); $this->corpusButtons[] = $this->renderGitLFSButton();
} catch (Exception $ex) { } catch (Exception $ex) {
$severity = PHUIInfoView::SEVERITY_ERROR; $severity = PHUIInfoView::SEVERITY_ERROR;
$messages[] = pht('The data for this file could not be loaded.'); $messages[] = pht('The data for this file could not be loaded.');

View file

@ -3,6 +3,7 @@
final class DiffusionBrowseResultSet extends Phobject { final class DiffusionBrowseResultSet extends Phobject {
const REASON_IS_FILE = 'is-file'; const REASON_IS_FILE = 'is-file';
const REASON_IS_SUBMODULE = 'is-submodule';
const REASON_IS_DELETED = 'is-deleted'; const REASON_IS_DELETED = 'is-deleted';
const REASON_IS_NONEXISTENT = 'nonexistent'; const REASON_IS_NONEXISTENT = 'nonexistent';
const REASON_BAD_COMMIT = 'bad-commit'; const REASON_BAD_COMMIT = 'bad-commit';

View file

@ -0,0 +1,41 @@
<?php
final class DiffusionPreCommitUsesGitLFSHeraldField
extends DiffusionPreCommitContentHeraldField {
const FIELDCONST = 'diffusion.pre.commit.git-lfs';
public function getHeraldFieldName() {
return pht('Commit uses Git LFS');
}
public function getFieldGroupKey() {
return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$map = $this->getAdapter()->getDiffContent('+');
// At the time of writing, all current Git LFS files begin with this
// line, verbatim:
//
// version https://git-lfs.github.com/spec/v1
//
// ...but we don't try to match the specific version here, in the hopes
// that this might also detect future versions.
$pattern = '(^version\s*https://git-lfs.github.com/spec/)i';
foreach ($map as $path => $content) {
if (preg_match($pattern, $content)) {
return true;
}
}
return false;
}
protected function getHeraldFieldStandardType() {
return self::STANDARD_BOOL;
}
}

View file

@ -40,6 +40,13 @@ final class DiffusionEmptyResultView extends DiffusionView {
$body = pht('This path was an empty directory at %s.', $commit); $body = pht('This path was an empty directory at %s.', $commit);
$severity = PHUIInfoView::SEVERITY_NOTICE; $severity = PHUIInfoView::SEVERITY_NOTICE;
break; break;
case DiffusionBrowseResultSet::REASON_IS_SUBMODULE:
$title = pht('Submodule');
// TODO: We could improve this, but it is normally difficult to
// reach this page for a submodule.
$body = pht('This path was a submodule at %s.', $commit);
$severity = PHUIInfoView::SEVERITY_NOTICE;
break;
case DiffusionBrowseResultSet::REASON_IS_DELETED: case DiffusionBrowseResultSet::REASON_IS_DELETED:
$deleted = $this->browseResultSet->getDeletedAtCommit(); $deleted = $this->browseResultSet->getDeletedAtCommit();
$existed = $this->browseResultSet->getExistedAtCommit(); $existed = $this->browseResultSet->getExistedAtCommit();

View file

@ -64,6 +64,7 @@ final class FileUploadChunkConduitAPIMethod
$params = array( $params = array(
'name' => $file->getMonogram().'.chunk-'.$chunk->getID(), 'name' => $file->getMonogram().'.chunk-'.$chunk->getID(),
'viewPolicy' => PhabricatorPolicies::POLICY_NOONE, 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE,
'chunk' => true,
); );
if ($mime_type !== null) { if ($mime_type !== null) {

View file

@ -40,6 +40,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
const METADATA_PROFILE = 'profile'; const METADATA_PROFILE = 'profile';
const METADATA_STORAGE = 'storage'; const METADATA_STORAGE = 'storage';
const METADATA_INTEGRITY = 'integrity'; const METADATA_INTEGRITY = 'integrity';
const METADATA_CHUNK = 'chunk';
const STATUS_ACTIVE = 'active'; const STATUS_ACTIVE = 'active';
const STATUS_DELETED = 'deleted'; const STATUS_DELETED = 'deleted';
@ -410,7 +411,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
try { try {
$file->updateDimensions(false); $file->updateDimensions(false);
} catch (Exception $ex) { } catch (Exception $ex) {
// Do nothing // Do nothing.
} }
$file->saveAndIndex(); $file->saveAndIndex();
@ -1057,9 +1058,20 @@ final class PhabricatorFile extends PhabricatorFileDAO
throw new Exception(pht('Cannot retrieve image information.')); throw new Exception(pht('Cannot retrieve image information.'));
} }
if ($this->getIsChunk()) {
throw new Exception(
pht('Refusing to assess image dimensions of file chunk.'));
}
$engine = $this->instantiateStorageEngine();
if ($engine->isChunkEngine()) {
throw new Exception(
pht('Refusing to assess image dimensions of chunked file.'));
}
$data = $this->loadFileData(); $data = $this->loadFileData();
$img = imagecreatefromstring($data); $img = @imagecreatefromstring($data);
if ($img === false) { if ($img === false) {
throw new Exception(pht('Error when decoding image.')); throw new Exception(pht('Error when decoding image.'));
} }
@ -1255,6 +1267,15 @@ final class PhabricatorFile extends PhabricatorFileDAO
return $this; return $this;
} }
public function getIsChunk() {
return idx($this->metadata, self::METADATA_CHUNK);
}
public function setIsChunk($value) {
$this->metadata[self::METADATA_CHUNK] = $value;
return $this;
}
public function setIntegrityHash($integrity_hash) { public function setIntegrityHash($integrity_hash) {
$this->metadata[self::METADATA_INTEGRITY] = $integrity_hash; $this->metadata[self::METADATA_INTEGRITY] = $integrity_hash;
return $this; return $this;
@ -1339,6 +1360,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
'mime-type' => 'optional string', 'mime-type' => 'optional string',
'builtin' => 'optional string', 'builtin' => 'optional string',
'storageEngines' => 'optional list<PhabricatorFileStorageEngine>', 'storageEngines' => 'optional list<PhabricatorFileStorageEngine>',
'chunk' => 'optional bool',
)); ));
$file_name = idx($params, 'name'); $file_name = idx($params, 'name');
@ -1416,6 +1438,11 @@ final class PhabricatorFile extends PhabricatorFileDAO
$this->setMimeType($mime_type); $this->setMimeType($mime_type);
} }
$is_chunk = idx($params, 'chunk');
if ($is_chunk) {
$this->setIsChunk(true);
}
return $this; return $this;
} }

View file

@ -189,6 +189,7 @@ abstract class PhabricatorFileUploadSource
$params = array( $params = array(
'name' => $file->getMonogram().'.chunk-'.$offset, 'name' => $file->getMonogram().'.chunk-'.$offset,
'viewPolicy' => PhabricatorPolicies::POLICY_NOONE, 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE,
'chunk' => true,
); );
// If this isn't the initial chunk, provide a dummy MIME type so we do not // If this isn't the initial chunk, provide a dummy MIME type so we do not

View file

@ -9,6 +9,7 @@ abstract class HeraldAction extends Phobject {
const STANDARD_NONE = 'standard.none'; const STANDARD_NONE = 'standard.none';
const STANDARD_PHID_LIST = 'standard.phid.list'; const STANDARD_PHID_LIST = 'standard.phid.list';
const STANDARD_TEXT = 'standard.text'; const STANDARD_TEXT = 'standard.text';
const STANDARD_REMARKUP = 'standard.remarkup';
const DO_STANDARD_EMPTY = 'do.standard.empty'; const DO_STANDARD_EMPTY = 'do.standard.empty';
const DO_STANDARD_NO_EFFECT = 'do.standard.no-effect'; const DO_STANDARD_NO_EFFECT = 'do.standard.no-effect';
@ -60,6 +61,8 @@ abstract class HeraldAction extends Phobject {
return new HeraldEmptyFieldValue(); return new HeraldEmptyFieldValue();
case self::STANDARD_TEXT: case self::STANDARD_TEXT:
return new HeraldTextFieldValue(); return new HeraldTextFieldValue();
case self::STANDARD_REMARKUP:
return new HeraldRemarkupFieldValue();
case self::STANDARD_PHID_LIST: case self::STANDARD_PHID_LIST:
$tokenizer = id(new HeraldTokenizerFieldValue()) $tokenizer = id(new HeraldTokenizerFieldValue())
->setKey($this->getHeraldActionName()) ->setKey($this->getHeraldActionName())

View file

@ -0,0 +1,79 @@
<?php
final class HeraldCommentAction extends HeraldAction {
const ACTIONCONST = 'comment';
const DO_COMMENT = 'do.comment';
public function getHeraldActionName() {
return pht('Add comment');
}
public function getActionGroupKey() {
return HeraldUtilityActionGroup::ACTIONGROUPKEY;
}
public function supportsObject($object) {
if (!($object instanceof PhabricatorApplicationTransactionInterface)) {
return false;
}
$xaction = $object->getApplicationTransactionTemplate();
try {
$comment = $xaction->getApplicationTransactionCommentObject();
if (!$comment) {
return false;
}
} catch (PhutilMethodNotImplementedException $ex) {
return false;
}
return true;
}
public function supportsRuleType($rule_type) {
return ($rule_type != HeraldRuleTypeConfig::RULE_TYPE_PERSONAL);
}
public function applyEffect($object, HeraldEffect $effect) {
$adapter = $this->getAdapter();
$comment_text = $effect->getTarget();
$xaction = $adapter->newTransaction()
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT);
$comment = $xaction->getApplicationTransactionCommentObject()
->setContent($comment_text);
$xaction->attachComment($comment);
$adapter->queueTransaction($xaction);
$this->logEffect(self::DO_COMMENT, $comment_text);
}
public function getHeraldActionStandardType() {
return self::STANDARD_REMARKUP;
}
protected function getActionEffectMap() {
return array(
self::DO_COMMENT => array(
'icon' => 'fa-comment',
'color' => 'blue',
'name' => pht('Added Comment'),
),
);
}
public function renderActionDescription($value) {
$summary = PhabricatorMarkupEngine::summarize($value);
return pht('Add comment: %s', $summary);
}
protected function renderActionEffectDescription($type, $data) {
$summary = PhabricatorMarkupEngine::summarize($data);
return pht('Added a comment: %s', $summary);
}
}

View file

@ -8,6 +8,7 @@ abstract class HeraldFieldValue extends Phobject {
const CONTROL_TEXT = 'herald.control.text'; const CONTROL_TEXT = 'herald.control.text';
const CONTROL_SELECT = 'herald.control.select'; const CONTROL_SELECT = 'herald.control.select';
const CONTROL_TOKENIZER = 'herald.control.tokenizer'; const CONTROL_TOKENIZER = 'herald.control.tokenizer';
const CONTROL_REMARKUP = 'herald.control.remarkup';
abstract public function getFieldValueKey(); abstract public function getFieldValueKey();
abstract public function getControlType(); abstract public function getControlType();

View file

@ -0,0 +1,22 @@
<?php
final class HeraldRemarkupFieldValue
extends HeraldFieldValue {
public function getFieldValueKey() {
return 'remarkup';
}
public function getControlType() {
return self::CONTROL_REMARKUP;
}
public function renderFieldValue($value) {
return $value;
}
public function renderEditorValue($value) {
return $value;
}
}

View file

@ -1627,8 +1627,7 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
return false; return false;
} }
// TODO: Unprototype this feature. if (!PhabricatorEnv::getEnvConfig('diffusion.allow-git-lfs')) {
if (!PhabricatorEnv::getEnvConfig('phabricator.show-prototypes')) {
return false; return false;
} }

View file

@ -37,6 +37,12 @@
padding: 2px 4px; padding: 2px 4px;
} }
.herald-action-table td textarea {
width: 95%;
height: 8em;
padding: 2px 4px;
}
.herald-action-table td.target { .herald-action-table td.target {
width: 100%; width: 100%;
} }

View file

@ -217,6 +217,11 @@ JX.install('HeraldRuleEditor', {
get_fn = function() { return input.value; }; get_fn = function() { return input.value; };
set_fn = function(v) { input.value = v; }; set_fn = function(v) { input.value = v; };
break; break;
case 'herald.control.remarkup':
input = JX.$N('textarea');
get_fn = function() { return input.value; };
set_fn = function(v) { input.value = v; };
break;
case 'herald.control.select': case 'herald.control.select':
var options; var options;