38 Commits

Author SHA1 Message Date
83bb30c02e Fix regex for safe file name to work correct for unicode 2023-02-09 15:08:15 +01:00
7209e70eee Fix undefined variable 2023-02-07 09:21:03 +01:00
21c4d6c988 Fix undefined function usage 2023-02-07 08:51:02 +01:00
c898053829 Baker: Support explicit timestamp specification
Limits the number of tasks and revisions which are to be checked,
speeding up the iteration.
2023-02-06 15:33:16 +01:00
5906c4a7e9 Use JSON format instead of python 2023-01-31 20:15:22 +01:00
9584c480ac Add utility scripts to collect updates tasks and files 2023-01-30 17:08:08 +01:00
dbb9853e4c Replace "View All Subscribers" link with text 2023-01-28 16:58:10 +01:00
a924b09c84 Ensure all meme macro are inlined 2023-01-28 13:24:06 +01:00
21d145c9dd Use the latest transaction modification time fore the hash 2023-01-27 16:13:16 +01:00
8eaab28e2e Fix wrong transaction query sued for tasks 2023-01-27 15:49:44 +01:00
d026dfa72b Fix rendering of arrays 2023-01-27 15:34:41 +01:00
3dab3e6ffb Disable remarkup cache and handle meme files properly 2023-01-25 15:41:36 +01:00
f9d454431a More correct handling of files with missing transform
Use the original file URI if the transform is not available.

The preview generation is done on-demand when one visits a URL,
which is not easy to do from a baker.
2023-01-25 09:40:59 +01:00
d1037ee999 Disable links to commit in the task's "Revisions and Commits" 2023-01-23 11:05:52 +01:00
2ae41b71ce Allow linking diffs from another revisions 2023-01-23 10:21:28 +01:00
ee2cdc66a3 Correct link to the diff id 2023-01-23 10:11:08 +01:00
8c725e1f30 Only open absolute links in the new window 2023-01-22 20:53:40 +01:00
af28ab583d Make links open in the new tab
This should allow opening links form inside baked
result shown from an iframe.
2023-01-22 17:26:02 +01:00
36c5a9da1e Correction for the previous commit 2023-01-22 15:46:58 +01:00
63443cef58 Correct links to the ghost comment navigation 2023-01-22 15:39:58 +01:00
4d0bbd65c2 Disable more links in various places 2023-01-22 10:43:29 +01:00
ab636281d4 Disable extra information link
It is not really easy to check it locally since some
real repo setup is needed. So, hope for the best.
2023-01-22 10:15:17 +01:00
ae771df2af Disable visibility of badges 2023-01-21 18:54:28 +01:00
e76e6e14c0 Remove Show Details link
It is not baked into.
2023-01-21 18:41:48 +01:00
b43fabc696 Disable links to people form comments 2023-01-21 18:33:27 +01:00
be6ca4dc7d Remove task creation crumbs 2023-01-21 18:21:24 +01:00
06ff69a03c Support rendering pages with crumbs 2023-01-21 18:18:29 +01:00
f28236b2cc Correct links to task
Also explicitly use index.html
2023-01-21 17:57:34 +01:00
895ebed023 Disable project workboard links 2023-01-21 17:47:59 +01:00
c06a59147c Implement maniphest baking 2023-01-21 17:38:01 +01:00
2d960622d3 Fix URL to the raw diff 2023-01-21 14:01:28 +01:00
d50ac79793 Tweaks to baker to use the final directory structure 2023-01-21 13:50:40 +01:00
f5633edf97 Order revisions from oldest to newest
Allows to more easily see the progress.
2023-01-17 12:49:47 +01:00
2ac637aa24 Allow git bundle to use conduit for file access
Some of the changes can not be accesses without this.

Also improved logging and skipped raw diffs if they
already exists.
2023-01-17 12:40:15 +01:00
092c2411d2 Disable buildable status
It contains not-trivial-to-find-links and it does not
bring much information because the CI/CD was never
integrated into the developer.b.o
2023-01-17 11:41:39 +01:00
b967dd64fa Print message about the initial query
Helps to see that the delay is actually expected.
2023-01-17 11:26:38 +01:00
affd4cfd0d Disable more links in the history and local commits 2023-01-17 11:21:54 +01:00
8a882018b9 Initial commit of differential baking changes
NOTE: This branch is not to be deployed as a website, but instead
to be used as a client of a cluster (to have access to the database)
and run the baking script in a unattended mode.

A lot of tweaks all over the place to make the generated HTML suitable
for use in a static HTML with remapped paths to be relative and so on.

NOTE: Because of those tweaks the file rendering and access will not
work as expected when viewed from the website: it will be 404 because
it has different means accessing files than the static HTML. It is not
possible to keep website rendering correct, but it makes it harder to
investigate what parts needs attention without running the baker.

The baking script is found in `scripts/bake/bake_differential.php`
and it receives a single argument which is a directory with the baked
files.

Covers the following aspects:
- File attachments
- Image previews
- Pastes

The user avatars are replaced with the default user avatar.
2023-01-17 10:19:43 +01:00
58 changed files with 1149 additions and 142 deletions

View File

@@ -9,10 +9,10 @@ return array(
'names' => array(
'conpherence.pkg.css' => '0e3cf785',
'conpherence.pkg.js' => '020aebcf',
'core.pkg.css' => '0fbedea0',
'core.pkg.css' => 'f784f26b',
'core.pkg.js' => '74ad315f',
'dark-console.pkg.js' => '187792c2',
'differential.pkg.css' => '5c459f92',
'differential.pkg.css' => '32879ab6',
'differential.pkg.js' => '218fda21',
'diffusion.pkg.css' => '42c75c37',
'diffusion.pkg.js' => 'a98c0bf7',
@@ -67,7 +67,7 @@ return array(
'rsrc/css/application/differential/core.css' => '7300a73e',
'rsrc/css/application/differential/phui-inline-comment.css' => '9863a85e',
'rsrc/css/application/differential/revision-comment.css' => '7dbc8d1d',
'rsrc/css/application/differential/revision-history.css' => '8aa3eac5',
'rsrc/css/application/differential/revision-history.css' => '04edcc29',
'rsrc/css/application/differential/revision-list.css' => '93d2df7d',
'rsrc/css/application/differential/table-of-contents.css' => 'bba788b9',
'rsrc/css/application/diffusion/diffusion-icons.css' => '23b31a1b',
@@ -147,7 +147,7 @@ return array(
'rsrc/css/phui/phui-comment-form.css' => '68a2d99a',
'rsrc/css/phui/phui-comment-panel.css' => 'ec4e31c0',
'rsrc/css/phui/phui-crumbs-view.css' => '614f43cf',
'rsrc/css/phui/phui-curtain-object-ref-view.css' => '12404744',
'rsrc/css/phui/phui-curtain-object-ref-view.css' => 'b43b7307',
'rsrc/css/phui/phui-curtain-view.css' => '68c5efb6',
'rsrc/css/phui/phui-document-pro.css' => 'b9613a10',
'rsrc/css/phui/phui-document-summary.css' => 'b068eed1',
@@ -574,7 +574,7 @@ return array(
'differential-core-view-css' => '7300a73e',
'differential-revision-add-comment-css' => '7e5900d9',
'differential-revision-comment-css' => '7dbc8d1d',
'differential-revision-history-css' => '8aa3eac5',
'differential-revision-history-css' => '04edcc29',
'differential-revision-list-css' => '93d2df7d',
'differential-table-of-contents-css' => 'bba788b9',
'diffusion-css' => 'b54c77b0',
@@ -848,7 +848,7 @@ return array(
'phui-comment-form-css' => '68a2d99a',
'phui-comment-panel-css' => 'ec4e31c0',
'phui-crumbs-view-css' => '614f43cf',
'phui-curtain-object-ref-view-css' => '12404744',
'phui-curtain-object-ref-view-css' => 'b43b7307',
'phui-curtain-view-css' => '68c5efb6',
'phui-document-summary-view-css' => 'b068eed1',
'phui-document-view-css' => '52b748a5',

576
scripts/bake/bake.php Normal file
View File

@@ -0,0 +1,576 @@
#!/usr/local/bin/php
<?php
/////////////////////////////////////////////////////////////////////////////////
// Bootstrap.
$PHABRICATOR_ROOT = dirname(dirname(dirname(__FILE__)));
require_once $PHABRICATOR_ROOT.'/scripts/__init_script__.php';
/////////////////////////////////////////////////////////////////////////////////
// Command line.
$argc = count($argv);
if ($argc < 3 || $argc > 4) {
print("Usage: $argv[0] <conduit_token_file> <output_directory> [timestamp]\n");
die;
}
$CONDUIT_TOKEN_FILE = $argv[1];
$OUTPUT_DIR = $argv[2];
$TIMESTAMP = ($argc == 4) ? (int)$argv[3] : 0;
/////////////////////////////////////////////////////////////////////////////////
// Global configuration.
$HOST = 'phabricator.local';
/////////////////////////////////////////////////////////////////////////////////
// Utilities.
// Create an instance of the AphrontApplicationConfiguration configured with all
// invariant settings (settings which do not change between handlers of different
// revisions).
function CreateApplicationConfiguration() {
global $HOST;
$application_configuration = new AphrontApplicationConfiguration();
$application_configuration->setHost($HOST);
return $application_configuration;
}
/////////////////////////////////////////////////////////////////////////////////
// Global state.
$site = id(new PhabricatorPlatformSite());
$viewer = PhabricatorUser::getOmnipotentUser();
$application_configuration = CreateApplicationConfiguration();
$differential_application = id(new PhabricatorDifferentialApplication());
$revision_controller = id(new DifferentialRevisionViewController())
->setCurrentApplication($differential_application);
$maniphest_application = id(new PhabricatorManiphestApplication());
$maniphest_controller = id(new ManiphestTaskDetailController())
->setCurrentApplication($maniphest_application);
$differential_routing_map = id(new AphrontRoutingMap())
->setSite($site)
->setApplication($differential_application)
->setRoutes($differential_application->getRoutes());
$maniphest_routing_map = id(new AphrontRoutingMap())
->setSite($site)
->setApplication($maniphest_application)
->setRoutes($maniphest_application->getRoutes());
$conduit = id(new ConduitClient('https://developer.blender.org/api/'))
->setConduitToken(trim(file_get_contents($CONDUIT_TOKEN_FILE)));
/////////////////////////////////////////////////////////////////////////////////
// Baking utilities.
function EnsureDirectoryOrDie($dir) {
if (!is_dir($dir)) {
if (!mkdir($dir, 0777, true)) {
print("Error creating output durectory $dir\n");
die;
}
}
}
function RenderElement($element) {
if (is_array($element)) {
$html = '';
foreach ($element as $child) {
$html .= RenderElement($child);
}
return $html;
}
return $element->render();
}
function RenderResponseToHTML($response) {
$html = '';
$crumbs = $response->getCrumbs();
if ($crumbs) {
$html .= $crumbs->render();
}
foreach ($response->renderChildren() as $child) {
$html .= RenderElement($child);
}
return $html;
}
/////////////////////////////////////////////////////////////////////////////////
// Revision baking.
class RevisionInfo {
public $title = '';
public $page_title = '';
public $last_diff_id = 0;
public $hash = '';
public static function ReadFromFile($file_name) {
$info = new RevisionInfo();
if (!file_exists($file_name)) {
return $info;
}
$json = json_decode(file_get_contents($file_name));
foreach ($json as $key => $value) {
$info->{$key} = $value;
}
return $info;
}
public function SaveToFile($file_name) {
$json_str = json_encode(get_object_vars($this));
file_put_contents($file_name, $json_str);
}
};
function GetRevisionOutputDirectory($revision) {
global $OUTPUT_DIR;
$id = $revision->getID();
return PathJoin(array($OUTPUT_DIR, 'differential', SubpathFromId($id)));
}
function EnsureRevisionOutputDirectory($revision) {
$dir = GetRevisionOutputDirectory($revision);
EnsureDirectoryOrDie($dir);
EnsureDirectoryOrDie(PathJoin(array($dir, 'raw_diff')));
return $dir;
}
function GetRevisionInfoFilename($revision) {
$revision_dir = GetRevisionOutputDirectory($revision);
return PathJoin(array($revision_dir, 'info.json'));
}
function GetRevisionHTMLFilename($revision, $diff_id) {
$revision_id = $revision->getID();
$revision_dir = GetRevisionOutputDirectory($revision);
$file_name = "D{$revision_id}.id{$diff_id}.html";
return PathJoin(array($revision_dir, $file_name));
}
function GetRevisionRawDiffFilename($revision, $diff_id) {
$revision_id = $revision->getID();
$revision_dir = GetRevisionOutputDirectory($revision);
$file_name = "D{$revision_id}.id{$diff_id}.diff";
return PathJoin(array($revision_dir, 'raw_diff', $file_name));
}
function RenderDifferentialToResponse($revision, $diff_id) {
global $application_configuration;
global $revision_controller;
global $differential_routing_map;
global $viewer;
$revision_id = $revision->getID();
$path = '/D' . $revision_id;
$route_result = $differential_routing_map->routePath($path);
$uri_data = $route_result->getURIData();
$application_configuration->setPath($path);
$request_data = array(
'id' => $diff_id,
);
$request = $application_configuration->buildRequest()
->setUser($viewer)
->setRequestData($request_data)
->setURIMap($uri_data);
$response = id($revision_controller)
->setRequest($request)
->handleRequest($request);
return $response;
}
function StoreRawDiff($revision, $diff_id) {
global $viewer;
global $conduit;
$diff = id(new DifferentialDiffQuery())
->setViewer($viewer)
->withIDs(array($diff_id))
->needChangesets(true)
->executeOne();
$raw_changes = $diff->buildChangesList();
$changes = array();
foreach ($raw_changes as $changedict) {
$changes[] = ArcanistDiffChange::newFromDictionary($changedict);
}
$bundle = ArcanistBundle::newFromChanges($changes);
$bundle->setConduit($conduit);
$raw_diff = $bundle->toGitPatch();
$output_file = GetRevisionRawDiffFilename($revision, $diff_id);
file_put_contents($output_file, $raw_diff);
}
function GetRevisionHash($revision) {
global $viewer;
$xaction = id(new DifferentialTransactionQuery())
->setViewer($viewer)
->withObjectPHIDs(array($revision->getPHID()))
->setOrder('updated')
->setLimit(1)
->executeOne();
$digest = '';
$digest .= $revision->getDateModified();
if ($xaction) {
$digest .= '_' . $xaction->getPHID();
$digest .= '_' . $xaction->getDateModified();
}
return $digest;
}
function NeedBakeRevision($info, $revision, $diff_id) {
if (!file_exists(GetRevisionHTMLFilename($revision, $diff_id))) {
return true;
}
if (!file_exists(GetRevisionRawDiffFilename($revision, $diff_id))) {
return true;
}
if ($info->last_diff_id < $diff_id) {
return true;
}
if ($revision->getTitle() != $info->title) {
return true;
}
if (GetRevisionHash($revision) != $info->hash) {
return true;
}
return false;
}
function BakeRevision($revision, $diff_id) {
$revision_id = $revision->getID();
printf('Baking D' . $revision_id . '?id=' . $diff_id . ' ...' . "\n");
$info_file_name = GetRevisionInfoFilename($revision);
$info = RevisionInfo::ReadFromFile($info_file_name);
if (!NeedBakeRevision($info, $revision, $diff_id)) {
print(' ... ignoring: up to date' . "\n");
return;
}
$response = RenderDifferentialToResponse($revision, $diff_id);
$html = RenderResponseToHTML($response);
$html_file_name = GetRevisionHTMLFIlename($revision, $diff_id);
file_put_contents($html_file_name, $html);
StoreRawDiff($revision, $diff_id);
$info->title = $revision->getTitle();
$info->page_title = $response->getTitle();
$info->hash = GetRevisionHash($revision);
$info->last_diff_id = max($info->last_diff_id, $diff_id);
$info->SaveToFile($info_file_name);
}
function GetAllRevisions() {
global $viewer;
return id(new DifferentialRevisionQuery())
->setViewer($viewer)
->needDiffIDs(true)
->setOrder('oldest')
->execute();
}
function GetModifiedRevisionsSince($timestamp) {
if (!$timestamp) {
return GetAllRevisions();
}
global $viewer;
$xactions = id(new DifferentialTransactionQuery())
->setViewer($viewer)
->setOrder('oldest')
->withUpdatedEpochAfter($timestamp)
->execute();
$revision_ids_set = array();
foreach ($xactions as $xaction_id => $xaction) {
$revision = $xaction->getObject();
$revision_id = $revision->getID();
$revision_ids_set[$revision_id] = 1;
}
$updated_revision_ids = array_keys($revision_ids_set);
return id(new DifferentialRevisionQuery())
->setViewer($viewer)
->needDiffIDs(true)
->setOrder('oldest')
->withIDs($updated_revision_ids)
->execute();
}
/////////////////////////////////////////////////////////////////////////////////
// Task baking.
class TaskInfo {
public $title = '';
public $page_title = '';
public $hash = '';
public static function ReadFromFile($file_name) {
$info = new TaskInfo();
if (!file_exists($file_name)) {
return $info;
}
$json = json_decode(file_get_contents($file_name));
foreach ($json as $key => $value) {
$info->{$key} = $value;
}
return $info;
}
public function SaveToFile($file_name) {
$json_str = json_encode(get_object_vars($this));
file_put_contents($file_name, $json_str);
}
};
function GetTaskOutputDirectory($task) {
global $OUTPUT_DIR;
$id = $task->getID();
return PathJoin(array($OUTPUT_DIR, 'maniphest', SubpathFromId($id)));
}
function EnsureTaskOutputDirectory($task) {
$dir = GetTaskOutputDirectory($task);
EnsureDirectoryOrDie($dir);
return $dir;
}
function GetTaskInfoFilename($task) {
$task_dir = GetTaskOutputDirectory($task);
return PathJoin(array($task_dir, 'info.json'));
}
function GetTaskHTMLFilename($task) {
$task_id = $task->getID();
$task_dir = GetTaskOutputDirectory($task);
$file_name = "index.html";
return PathJoin(array($task_dir, $file_name));
}
function RenderTaskToResponse($task) {
global $application_configuration;
global $maniphest_routing_map;
global $viewer;
global $maniphest_controller;
$task_id = $task->getID();
$path = '/T' . $task_id;
$route_result = $maniphest_routing_map->routePath($path);
$uri_data = $route_result->getURIData();
$application_configuration->setPath($path);
$request_data = array(
);
$request = $application_configuration->buildRequest()
->setUser($viewer)
->setRequestData($request_data)
->setURIMap($uri_data);
$response = id($maniphest_controller)
->setRequest($request)
->handleRequest($request);
return $response;
}
function GetTaskHash($task) {
global $viewer;
$xaction = id(new ManiphestTransactionQuery())
->setViewer($viewer)
->withObjectPHIDs(array($task->getPHID()))
->setOrder('updated')
->setLimit(1)
->executeOne();
$digest = '';
$digest .= $task->getDateModified();
if ($xaction) {
$digest .= '_' . $xaction->getPHID();
$digest .= '_' . $xaction->getDateModified();
}
return $digest;
}
function NeedBakeTask($info, $task) {
if (!file_exists(GetTaskHTMLFilename($task))) {
return true;
}
if ($task->getTitle() != $info->title) {
return true;
}
if (GetTaskHash($task) != $info->hash) {
return true;
}
return false;
}
function BakeTask($task) {
$task_id = $task->getID();
printf('Baking T' . $task_id . ' ...' . "\n");
$info_file_name = GetTaskInfoFilename($task);
$info = TaskInfo::ReadFromFile($info_file_name);
if (!NeedBakeTask($info, $task)) {
print(' ... ignoring: up to date' . "\n");
return;
}
$response = RenderTaskToResponse($task);
$html = RenderResponseToHTML($response);
$html_file_name = GetTaskHTMLFIlename($task);
file_put_contents($html_file_name, $html);
$info->title = $task->getTitle();
$info->page_title = $response->getTitle();
$info->hash = GetTaskHash($task);
$info->SaveToFile($info_file_name);
}
function GetAllTasks() {
global $viewer;
return id(new ManiphestTaskQuery())
->setViewer($viewer)
->setOrder('oldest')
->execute();
}
function GetModifiedTasksSinze($timestamp) {
if (!$timestamp) {
return GetAllTasks();
}
global $viewer;
$xactions = id(new ManiphestTransactionQuery())
->setViewer($viewer)
->setOrder('updated')
->withUpdatedEpochAfter($timestamp)
->execute();
$task_ids_set = array();
foreach ($xactions as $xaction_id => $xaction) {
$task = $xaction->getObject();
$task_id = $task->getID();
$task_ids_set[$task_id] = 1;
}
$updated_task_ids = array_keys($task_ids_set);
return id(new ManiphestTaskQuery())
->setViewer($viewer)
->setOrder('oldest')
->withIDs($updated_task_ids)
->execute();
}
/////////////////////////////////////////////////////////////////////////////////
// Baking main loop.
print('Querying differential revisions from the database ... ' . "\n");
$revisions = GetModifiedRevisionsSince($TIMESTAMP);
foreach ($revisions as $revision_id => $revision) {
EnsureRevisionOutputDirectory($revision);
foreach ($revision->getDiffIDs() as $diff_id) {
BakeRevision($revision, $diff_id);
}
}
print("\n");
print('Querying maniphest tasks from the database ... ' . "\n");
$tasks = GetModifiedTasksSinze($TIMESTAMP);
foreach ($tasks as $task_id => $task) {
EnsureTaskOutputDirectory($task);
BakeTask($task);
}
?>

View File

@@ -0,0 +1,49 @@
#!/usr/local/bin/php
<?php
$PHABRICATOR_ROOT = dirname(dirname(dirname(__FILE__)));
require_once $PHABRICATOR_ROOT.'/scripts/__init_script__.php';
if (count($argv) != 2) {
print("Usage: $argv[0] timestamp\n");
die;
}
$TIMESTAMP = $argv[1];
$viewer = PhabricatorUser::getOmnipotentUser();
$xactions = id(new ManiphestTransactionQuery())
->setViewer($viewer)
->setOrder('updated')
->withUpdatedEpochAfter($TIMESTAMP)
->execute();
$tasks = array();
foreach ($xactions as $xaction_id => $xaction) {
$task = $xaction->getObject();
$task_id = $task->getID();
$tasks[$task_id] = 1;
}
$task_ids = array_keys($tasks);
sort($task_ids);
$handle = fopen("tasks.json", "w");
fwrite($handle, "[\n");
$is_first = true;
foreach ($task_ids as $task_id ) {
if (!$is_first) {
fwrite($handle, ",\n");
}
fwrite($handle, " {$task_id}");
$is_first = false;
}
fwrite($handle, "\n]\n");
fclose($handle);
?>

View File

@@ -0,0 +1,32 @@
#!/usr/local/bin/php
<?php
$PHABRICATOR_ROOT = dirname(dirname(dirname(__FILE__)));
require_once $PHABRICATOR_ROOT.'/scripts/__init_script__.php';
$viewer = PhabricatorUser::getOmnipotentUser();
# print("Querying all files...\n");
$files = id(new PhabricatorFileQuery())
->setViewer($viewer)
->setOrder('oldest')
->execute();
# print("Looping over the files\n");
print("ids = (\n");
foreach ($files as $file_id => $file) {
$authorPHID = $file->getAuthorPHID();
if (!$authorPHID) {
$name = $file->getName();
if (substr($name, 0, 8) != 'preview-') {
$prev_file = $file;
continue;
}
}
print($file->getID() . ",\n");
}
print(")\n");
?>

View File

@@ -5958,6 +5958,9 @@ phutil_register_library_map(array(
'UserWhoAmIConduitAPIMethod' => 'applications/people/conduit/UserWhoAmIConduitAPIMethod.php',
),
'function' => array(
'MakeFilemameSafe' => 'infrastructure/util/PhabricatorID.php',
'PathJoin' => 'infrastructure/util/PhabricatorID.php',
'SubpathFromId' => 'infrastructure/util/PhabricatorID.php',
'celerity_generate_unique_node_id' => 'applications/celerity/api.php',
'celerity_get_resource_uri' => 'applications/celerity/api.php',
'hsprintf' => 'infrastructure/markup/render.php',

View File

@@ -334,7 +334,7 @@ abstract class PhabricatorController extends AphrontController {
}
$crumbs[] = id(new PHUICrumbView())
->setHref($this->getApplicationURI())
// ->setHref($this->getApplicationURI())
->setName($application->getName())
->setIcon($icon);
}

View File

@@ -180,7 +180,7 @@ final class DifferentialRevisionViewController
$request_uri = $request->getRequestURI();
$large = $request->getStr('large');
$large = $request->getStr('large') && true;
$large_warning =
($this->isLargeDiff()) &&
@@ -310,7 +310,7 @@ final class DifferentialRevisionViewController
$header = $this->buildHeader($revision);
$subheader = $this->buildSubheaderView($revision);
$details = $this->buildDetails($revision, $field_list);
$curtain = $this->buildCurtain($revision);
$curtain = $this->buildCurtain($revision, $target_id);
$repository = $revision->getRepository();
if ($repository) {
@@ -553,7 +553,8 @@ final class DifferentialRevisionViewController
$tab_header = id(new PHUIHeaderView())
->setHeader(pht('Revision Contents'))
->addActionLink($view_button);
// ->addActionLink($view_button)
;
$tab_view = id(new PHUIObjectBoxView())
->setHeader($tab_header)
@@ -663,7 +664,7 @@ final class DifferentialRevisionViewController
$view = id(new PHUIHeaderView())
->setHeader($revision->getTitle($revision))
->setUser($this->getViewer())
->setPolicyObject($revision)
// ->setPolicyObject($revision)
->setHeaderIcon('fa-cog');
$status_tag = id(new PHUITagView())
@@ -710,7 +711,7 @@ final class DifferentialRevisionViewController
return id(new PHUIHeadThingView())
->setImage($image_uri)
->setImageHref($image_href)
// ->setImageHref($image_href)
->setContent($content);
}
@@ -737,7 +738,7 @@ final class DifferentialRevisionViewController
->appendChild($properties);
}
private function buildCurtain(DifferentialRevision $revision) {
private function buildCurtain(DifferentialRevision $revision, $diff_id) {
$viewer = $this->getViewer();
$revision_id = $revision->getID();
$revision_phid = $revision->getPHID();
@@ -748,48 +749,48 @@ final class DifferentialRevisionViewController
$revision,
PhabricatorPolicyCapability::CAN_EDIT);
$curtain->addAction(
id(new PhabricatorActionView())
->setIcon('fa-pencil')
->setHref("/differential/revision/edit/{$revision_id}/")
->setName(pht('Edit Revision'))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
// $curtain->addAction(
// id(new PhabricatorActionView())
// ->setIcon('fa-pencil')
// ->setHref("/differential/revision/edit/{$revision_id}/")
// ->setName(pht('Edit Revision'))
// ->setDisabled(!$can_edit)
// ->setWorkflow(!$can_edit));
$curtain->addAction(
id(new PhabricatorActionView())
->setIcon('fa-upload')
->setHref("/differential/revision/update/{$revision_id}/")
->setName(pht('Update Diff'))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
// $curtain->addAction(
// id(new PhabricatorActionView())
// ->setIcon('fa-upload')
// ->setHref("/differential/revision/update/{$revision_id}/")
// ->setName(pht('Update Diff'))
// ->setDisabled(!$can_edit)
// ->setWorkflow(!$can_edit));
$request_uri = $this->getRequest()->getRequestURI();
$curtain->addAction(
id(new PhabricatorActionView())
->setIcon('fa-download')
->setName(pht('Download Raw Diff'))
->setHref($request_uri->alter('download', 'true')));
->setHref('raw_diff/D' . $revision_id . '.id' . $diff_id . '.diff'));
$relationship_list = PhabricatorObjectRelationshipList::newForObject(
$viewer,
$revision);
$revision_actions = array(
DifferentialRevisionHasParentRelationship::RELATIONSHIPKEY,
DifferentialRevisionHasChildRelationship::RELATIONSHIPKEY,
);
$revision_submenu = $relationship_list->newActionSubmenu($revision_actions)
->setName(pht('Edit Related Revisions...'))
->setIcon('fa-cog');
$curtain->addAction($revision_submenu);
$relationship_submenu = $relationship_list->newActionMenu();
if ($relationship_submenu) {
$curtain->addAction($relationship_submenu);
}
// $revision_actions = array(
// DifferentialRevisionHasParentRelationship::RELATIONSHIPKEY,
// DifferentialRevisionHasChildRelationship::RELATIONSHIPKEY,
// );
//
// $revision_submenu = $relationship_list->newActionSubmenu($revision_actions)
// ->setName(pht('Edit Related Revisions...'))
// ->setIcon('fa-cog');
//
// $curtain->addAction($revision_submenu);
//
// $relationship_submenu = $relationship_list->newActionMenu();
// if ($relationship_submenu) {
// $curtain->addAction($relationship_submenu);
// }
$repository = $revision->getRepository();
if ($repository && $repository->canPerformAutomation()) {
@@ -870,6 +871,7 @@ final class DifferentialRevisionViewController
$raw_changesets = id(new DifferentialChangesetQuery())
->setViewer($viewer)
->withDiffs($load_diffs)
->needHunks(true)
->execute();
$changeset_groups = mgroup($raw_changesets, 'getDiffID');

View File

@@ -33,9 +33,14 @@ final class DifferentialDiffPHIDType extends PhabricatorPHIDType {
$diff = $objects[$phid];
$id = $diff->getID();
$revision_id = $diff->getRevisionID();
$handle->setName(pht('Diff %d', $id));
$handle->setURI("/differential/diff/{$id}/");
$subpath = SubpathFromId($revision_id);
$uri = '../../../differential/' . $subpath . '/' . "D{$revision_id}.id{$id}.html";
$handle->setURI("$uri");
}
}

View File

@@ -3,8 +3,29 @@
final class DifferentialTransactionQuery
extends PhabricatorApplicationTransactionQuery {
private $updatedEpochAfter;
public function getTemplateApplicationTransaction() {
return new DifferentialTransaction();
}
public function withUpdatedEpochAfter($epoch) {
$this->updatedEpochAfter = $epoch;
return $this;
}
protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->updatedEpochAfter !== null) {
$where[] = qsprintf(
$conn,
'x.dateModified >= %d',
$this->updatedEpochAfter);
}
$where[] = $this->buildWhereClauseParts($conn);
return $this->formatWhereClause($conn, $where);
}
}

View File

@@ -589,15 +589,15 @@ abstract class DifferentialChangesetHTMLRenderer
$reference = $this->getRenderingReference();
return javelin_tag(
'a',
'span',
array(
'href' => '#',
'mustcapture' => true,
'sigil' => 'show-more',
'meta' => array(
'type' => ($is_all ? 'all' : null),
'range' => $range,
),
// 'href' => '#',
// 'mustcapture' => true,
// 'sigil' => 'show-more',
// 'meta' => array(
// 'type' => ($is_all ? 'all' : null),
// 'range' => $range,
// ),
),
$text);
}

View File

@@ -147,7 +147,8 @@ final class DifferentialRevision extends DifferentialDAO
}
public function getURI() {
return '/'.$this->getMonogram();
$subpath = SubpathFromId($this->getID());
return '../../../differential/' . $subpath . '/index.html';
}
public function getCommitPHIDs() {

View File

@@ -68,6 +68,8 @@ final class DifferentialTransactionComment
}
public function shouldUseMarkupCache($field) {
return false;
// Only cache submitted comments.
return ($this->getTransactionPHID() != null);
}

View File

@@ -187,13 +187,13 @@ final class DifferentialChangesetListView extends AphrontView {
$uniq_id = 'diff-'.$changeset->getAnchorName();
$detail->setID($uniq_id);
$view_options = $this->renderViewOptionsDropdown(
$detail,
$ref,
$changeset);
// $view_options = $this->renderViewOptionsDropdown(
// $detail,
// $ref,
// $changeset);
$detail->setChangeset($changeset);
$detail->addButton($view_options);
// $detail->addButton($view_options);
$detail->setSymbolIndex(idx($this->symbolIndexes, $key));
$detail->setVsChangesetID(idx($this->vsMap, $changeset->getID()));
$detail->setEditable(true);
@@ -202,7 +202,107 @@ final class DifferentialChangesetListView extends AphrontView {
$detail->setRenderURI($this->renderURI);
$parser = $this->getParser();
// $parser = $this->getParser();
$revision_id = $diff->getRevisionID();
$revision = id(new DifferentialRevisionQuery())
->setViewer($viewer)
->withIDs(array($revision_id))
->executeOne();
$old = array();
$new = array();
$right = $changeset;
$left = null;
$right_source = $right->getID();
$right_new = true;
$left_source = $right->getID();
$left_new = false;
$render_cache_key = $right->getID();
$old[] = $changeset;
$new[] = $changeset;
$parser = id(new DifferentialChangesetParser())
->setViewer($viewer)
->setViewState(new PhabricatorChangesetViewState())
// ->setCoverage($coverage)
->setChangeset($changeset)
->setRenderingReference($ref)
->setRenderCacheKey($render_cache_key)
->setRightSideCommentMapping($right_source, $right_new)
->setLeftSideCommentMapping($left_source, $left_new)
->setMask(array())
;
if ($left && $right) {
$parser->setOriginals($left, $right);
}
if ($revision) {
$inlines = id(new DifferentialDiffInlineCommentQuery())
->setViewer($viewer)
->withRevisionPHIDs(array($revision->getPHID()))
->withPublishableComments(true)
->withPublishedComments(true)
->needHidden(true)
->needInlineContext(true)
->execute();
$inlines = mpull($inlines, 'newInlineCommentObject');
$inlines = id(new PhabricatorInlineCommentAdjustmentEngine())
->setViewer($viewer)
->setRevision($revision)
->setOldChangesets($old)
->setNewChangesets($new)
->setInlines($inlines)
->execute();
} else {
$inlines = array();
}
if ($left_new) {
$inlines = array_merge(
$inlines,
$this->buildLintInlineComments($left));
}
if ($right_new) {
$inlines = array_merge(
$inlines,
$this->buildLintInlineComments($right));
}
$phids = array();
foreach ($inlines as $inline) {
$parser->parseInlineComment($inline);
if ($inline->getAuthorPHID()) {
$phids[$inline->getAuthorPHID()] = true;
}
}
$phids = array_keys($phids);
$handles = $this->loadViewerHandles($phids);
$parser->setHandles($handles);
$engine = new PhabricatorMarkupEngine();
$engine->setViewer($viewer);
foreach ($inlines as $inline) {
$engine->addObject(
$inline,
PhabricatorInlineComment::MARKUP_FIELD_BODY);
}
$engine->process();
$parser
->setMarkupEngine($engine);
if ($parser) {
$response = $parser->newChangesetResponse();
$detail->setChangesetResponse($response);
@@ -471,4 +571,92 @@ final class DifferentialChangesetListView extends AphrontView {
return $uri;
}
private function buildLintInlineComments($changeset) {
$diff = $changeset->getDiff();
$target_phids = $diff->getBuildTargetPHIDs();
if (!$target_phids) {
return array();
}
$messages = id(new HarbormasterBuildLintMessage())->loadAllWhere(
'buildTargetPHID IN (%Ls) AND path = %s',
$target_phids,
$changeset->getFilename());
if (!$messages) {
return array();
}
$change_type = $changeset->getChangeType();
if (DifferentialChangeType::isDeleteChangeType($change_type)) {
// If this is a lint message on a deleted file, show it on the left
// side of the UI because there are no source code lines on the right
// side of the UI so inlines don't have anywhere to render. See PHI416.
$is_new = 0;
} else {
$is_new = 1;
}
$template = id(new DifferentialInlineComment())
->setChangesetID($changeset->getID())
->setIsNewFile($is_new)
->setLineLength(0);
$inlines = array();
foreach ($messages as $message) {
$description = $message->getProperty('description');
$inlines[] = id(clone $template)
->setSyntheticAuthor(pht('Lint: %s', $message->getName()))
->setLineNumber($message->getLine())
->setContent($description);
}
return $inlines;
}
private function loadCoverage(DifferentialChangeset $changeset) {
$viewer = $this->getViewer();
$target_phids = $changeset->getDiff()->getBuildTargetPHIDs();
if (!$target_phids) {
return null;
}
$unit = id(new HarbormasterBuildUnitMessageQuery())
->setViewer($viewer)
->withBuildTargetPHIDs($target_phids)
->execute();
if (!$unit) {
return null;
}
$coverage = array();
foreach ($unit as $message) {
$test_coverage = $message->getProperty('coverage');
if ($test_coverage === null) {
continue;
}
$coverage_data = idx($test_coverage, $changeset->getFileName());
if (!strlen($coverage_data)) {
continue;
}
$coverage[] = $coverage_data;
}
if (!$coverage) {
return null;
}
return ArcanistUnitTestResult::mergeCoverage($coverage);
}
protected function loadViewerHandles(array $phids) {
return id(new PhabricatorHandleQuery())
->setViewer($this->getViewer())
->withPHIDs($phids)
->execute();
}
}

View File

@@ -82,7 +82,7 @@ final class DifferentialLocalCommitsView extends AphrontView {
$view->setSome($summary);
if ($message && (trim($summary) != trim($message))) {
$view->setMore(phutil_escape_html_newlines($message));
// $view->setMore(phutil_escape_html_newlines($message));
}
$row[] = $view->render();
@@ -137,9 +137,9 @@ final class DifferentialLocalCommitsView extends AphrontView {
$commit_hash = self::formatCommit($hash);
if ($commit_for_link) {
$link = phutil_tag(
'a',
'span',
array(
'href' => $commit_for_link->getURI(),
// 'href' => $commit_for_link->getURI(),
),
$commit_hash);
} else {

View File

@@ -178,7 +178,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$id_link = phutil_tag(
'a',
array(
'href' => '/D'.$revision_id.'?id='.$id,
'href' => 'D'.$revision_id.'.id'.$id.'.html',
),
$id);
} else {
@@ -196,19 +196,27 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$base,
$desc,
$age,
$lint,
$unit,
$old,
$new,
// $lint,
// $unit,
// $old,
// $new,
);
$classes = array();
/*
if ($old_class) {
$classes[] = 'differential-update-history-old-now';
}
if ($new_class) {
$classes[] = 'differential-update-history-new-now';
}
*/
if ($id && $this->selectedDiffID == $id) {
$classes[] = 'differential-update-history-current';
}
$rowc[] = nonempty(implode(' ', $classes), null);
}
@@ -226,10 +234,10 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
pht('Base'),
pht('Description'),
pht('Created'),
pht('Lint'),
pht('Unit'),
'',
'',
// pht('Lint'),
// pht('Unit'),
// '',
// '',
));
$table->setColumnClasses(
array(
@@ -238,8 +246,8 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
'',
'wide',
'date',
'center',
'center',
// 'center',
// 'center',
'center differential-update-history-old',
'center differential-update-history-new',
));
@@ -251,8 +259,8 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
false,
true,
false,
false,
false,
// false,
// false,
true,
true,
));
@@ -276,7 +284,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
),
array(
$table,
$show_diff,
// $show_diff,
));
return $content;
@@ -392,8 +400,10 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$diff->getSourceControlBaseRevision());
if ($commit_for_link) {
$link = phutil_tag(
'a',
array('href' => $commit_for_link->getURI()),
'span',
array(
'href' => $commit_for_link->getURI()
),
$label);
} else {
$link = $label;

View File

@@ -143,10 +143,15 @@ final class PhabricatorEmbedFileRemarkupRule
$xform = PhabricatorFileTransform::getTransformByKey($preview_key);
$existing_xform = $file->getTransform($preview_key);
// if ($existing_xform) {
// $xform_uri = $existing_xform->getCDNURI('data');
// } else {
// $xform_uri = $file->getURIForTransform($xform);
// }
if ($existing_xform) {
$xform_uri = $existing_xform->getCDNURI('data');
$xform_uri = $existing_xform->getInfoURI();
} else {
$xform_uri = $file->getURIForTransform($xform);
$xform_uri = $file->getInfoURI();
}
$attrs['src'] = $xform_uri;

View File

@@ -825,11 +825,12 @@ final class PhabricatorFile extends PhabricatorFileDAO
}
public function getViewURI() {
return $this->getInfoURI();
if (!$this->getPHID()) {
throw new Exception(
pht('You must save a file before you can generate a view URI.'));
}
return $this->getCDNURI('data');
}
@@ -875,13 +876,14 @@ final class PhabricatorFile extends PhabricatorFileDAO
}
}
public function getInfoURI() {
return '/'.$this->getMonogram();
$safe_name = MakeFilemameSafe($this->getName());
$subpath = SubpathFromId($this->getID());
return '../../../file/' . $subpath . '/' . $safe_name;
}
public function getBestURI() {
if ($this->isViewableInBrowser()) {
if ($this->isViewableInBrowser() && false) {
return $this->getViewURI();
} else {
return $this->getInfoURI();
@@ -889,7 +891,8 @@ final class PhabricatorFile extends PhabricatorFileDAO
}
public function getDownloadURI() {
return $this->getCDNURI('download');
return $this->getInfoURI();
// return $this->getCDNURI('download');
}
public function getURIForTransform(PhabricatorFileTransform $transform) {

View File

@@ -55,7 +55,7 @@ final class PhabricatorFlagsUIEventListener extends PhabricatorEventListener {
}
$actions = $event->getValue('actions');
$actions[] = $flag_action;
// $actions[] = $flag_action;
$event->setValue('actions', $actions);
}

View File

@@ -147,7 +147,7 @@ final class HarbormasterUIEventListener
}
$view = $ui_event->getValue('view');
$view->addProperty(pht('Build Status'), $status_view);
// $view->addProperty(pht('Build Status'), $status_view);
}
}

View File

@@ -39,7 +39,7 @@ final class PhabricatorMemeRemarkupRule extends PhutilRemarkupRule {
$is_html_mail = $this->getEngine()->isHTMLMailMode();
$is_text = $this->getEngine()->isTextMode();
$must_inline = ($is_html_mail || $is_text);
$must_inline = ($is_html_mail || $is_text || true);
if ($must_inline) {
if (!$asset) {

View File

@@ -148,6 +148,7 @@ abstract class ManiphestController extends PhabricatorController {
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
return $crumbs;
if ($this->projectKey) {
$user = $this->getRequest()->getUser();

View File

@@ -210,7 +210,8 @@ final class ManiphestTaskDetailController extends ManiphestController {
$view = id(new PHUIHeaderView())
->setHeader($task->getTitle())
->setUser($this->getRequest()->getUser())
->setPolicyObject($task);
// ->setPolicyObject($task)
;
$priority_name = ManiphestTaskPriority::getTaskPriorityName(
$task->getPriority());
@@ -271,6 +272,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
$curtain = $this->newCurtainView($task);
/*
$curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Task'))
@@ -278,6 +280,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
->setHref($this->getApplicationURI("/task/edit/{$id}/"))
->setDisabled(!$can_edit)
->setWorkflow($workflow_edit));
*/
$subtype_map = $task->newEditEngineSubtypeMap();
$subtask_options = $subtype_map->getCreateFormsForSubtype(
@@ -325,16 +328,20 @@ final class ManiphestTaskDetailController extends ManiphestController {
ManiphestTaskCloseAsDuplicateRelationship::RELATIONSHIPKEY,
);
/*
$task_submenu = $relationship_list->newActionSubmenu($submenu_actions)
->setName(pht('Edit Related Tasks...'))
->setIcon('fa-anchor');
$curtain->addAction($task_submenu);
*/
/*
$relationship_submenu = $relationship_list->newActionMenu();
if ($relationship_submenu) {
$curtain->addAction($relationship_submenu);
}
*/
$viewer_phid = $viewer->getPHID();
$owner_phid = $task->getOwnerPHID();
@@ -633,9 +640,9 @@ final class ManiphestTaskDetailController extends ManiphestController {
$commit_monogram);
$commit_link = javelin_tag(
'a',
'span',
array(
'href' => $commit->getURI(),
// 'href' => $commit->getURI(),
'sigil' => 'hovercard',
'meta' => array(
'hoverPHID' => $commit->getPHID(),

View File

@@ -36,7 +36,7 @@ final class ManiphestTaskPHIDType extends PhabricatorPHIDType {
$handle->setName("T{$id}");
$handle->setFullName("T{$id}: {$title}");
$handle->setURI("/T{$id}");
$handle->setURI($task->getURI());
if ($task->isClosed()) {
$handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED);

View File

@@ -3,8 +3,30 @@
final class ManiphestTransactionQuery
extends PhabricatorApplicationTransactionQuery {
private $updatedEpochAfter;
public function getTemplateApplicationTransaction() {
return new ManiphestTransaction();
}
public function withUpdatedEpochAfter($epoch) {
$this->updatedEpochAfter = $epoch;
return $this;
}
protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->updatedEpochAfter !== null) {
$where[] = qsprintf(
$conn,
'x.dateModified >= %d',
$this->updatedEpochAfter);
}
$where[] = $this->buildWhereClauseParts($conn);
return $this->formatWhereClause($conn, $where);
}
}

View File

@@ -193,7 +193,8 @@ final class ManiphestTask extends ManiphestDAO
}
public function getURI() {
return '/'.$this->getMonogram();
$subpath = SubpathFromId($this->getID());
return '../../../maniphest/' . $subpath . '/index.html';
}
public function attachGroupByProjectPHID($phid) {
@@ -311,6 +312,8 @@ final class ManiphestTask extends ManiphestDAO
* @task markup
*/
public function shouldUseMarkupCache($field) {
return false;
return (bool)$this->getID();
}

View File

@@ -37,7 +37,8 @@ final class PhabricatorPastePastePHIDType extends PhabricatorPHIDType {
$handle->setName("P{$id}");
$handle->setFullName($name);
$handle->setURI("/P{$id}");
$handle->setURI($paste->getURI());
}
}

View File

@@ -176,7 +176,7 @@ final class PhabricatorPasteSearchEngine
$item = id(new PHUIObjectItemView())
->setObjectName('P'.$paste->getID())
->setHeader($title)
->setHref('/P'.$paste->getID())
->setHref($paste->getURI())
->setObject($paste)
->addByline(pht('Author: %s', $author))
->addIcon('none', $created)

View File

@@ -60,7 +60,8 @@ final class PhabricatorPaste extends PhabricatorPasteDAO
}
public function getURI() {
return '/'.$this->getMonogram();
$subpath = SubpathFromId($this->getID());
return '../../../paste/' . $subpath . '/P' . $this->getID() . '.txt';
}
public function getMonogram() {

View File

@@ -11,6 +11,8 @@ final class PhabricatorPasteTransactionComment
}
public function shouldUseMarkupCache($field) {
return false;
// Only cache submitted comments.
return ($this->getTransactionPHID() != null);
}

View File

@@ -38,7 +38,7 @@ final class PasteEmbedView extends AphrontView {
$link = phutil_tag(
'a',
array(
'href' => '/P'.$this->paste->getID(),
'href' => $this->paste->getURI(),
),
$this->handle->getFullName());

View File

@@ -144,7 +144,8 @@ final class PhabricatorMentionRemarkupRule extends PhutilRemarkupRule {
->setType(PHUITagView::TYPE_PERSON)
->setPHID($user->getPHID())
->setName('@'.$user->getFullName())
->setHref($user_href);
// ->setHref($user_href)
;
if ($user_has_no_permission) {
$tag->addClass('phabricator-remarkup-mention-nopermission');

View File

@@ -608,6 +608,8 @@ final class PhabricatorUser
}
public function getProfileImageURI() {
return '/rsrc/image/avatar.png';
$uri_key = PhabricatorUserProfileImageCacheType::KEY_URI;
return $this->requireCacheData($uri_key);
}
@@ -982,6 +984,10 @@ final class PhabricatorUser
return $this->handlePool->newHandleList($phids);
}
public function getHandlePool() {
return $this->handlePool;
}
/**
* Get a @{class:PHUIHandleView} for a single handle.

View File

@@ -121,9 +121,9 @@ final class PhabricatorUserCardView extends AphrontTagView {
$user->getUsername());
$image = phutil_tag(
'a',
'span',
array(
'href' => $href,
// 'href' => $href,
'class' => 'project-card-image-href',
),
$image);

View File

@@ -146,7 +146,16 @@ final class PhabricatorObjectHandle
}
public function getURI() {
$type = $this->getType();
if ($type == 'TASK') {
// XXX: Use real link to gitea task
// At least for now rely on the existence of the manip[hest task redirector.
// return 'https://developer.blender.org' . $this->uri;
return $this->uri;
} else if ($type == 'DREV' || $type == 'DIFF' || $type == 'PSTE' || $type == 'FILE') {
return $this->uri;
}
return null;
}
public function setPHID($phid) {
@@ -357,7 +366,7 @@ final class PhabricatorObjectHandle
);
return javelin_tag(
$uri ? 'a' : 'span',
$uri ? 'a' : 'b',
$attributes,
array($circle, $icon, $name));
}

View File

@@ -22,6 +22,10 @@ final class PhabricatorHandlePool extends Phobject {
return $this->viewer;
}
public function getHandles() {
return $this->handles;
}
public function newHandleList(array $phids) {
// Mark any PHIDs we haven't loaded yet as unloaded. This will let us bulk
// load them later.

View File

@@ -60,7 +60,7 @@ final class PhabricatorProjectsCurtainExtension
),
$column_name);
$annotation[] = $column_link;
// $annotation[] = $column_link;
}
if ($annotation) {

View File

@@ -76,14 +76,10 @@ final class PhabricatorSubscriptionsCurtainExtension
}
if ($show_all) {
$view_all_uri = urisprintf(
'/subscriptions/list/%s/',
$object_phid);
$ref_list->newTailLink()
->setURI($view_all_uri)
->setText(pht('View All %d Subscriber(s)', $subscriber_count))
->setWorkflow(true);
$num_extra = $subscriber_count - $max_visible;
if ($num_extra > 0) {
$ref_list->addTailObject("{$num_extra} More Subscribers");
}
}
return $this->newPanel()

View File

@@ -112,8 +112,8 @@ final class PhabricatorSubscriptionsUIEventListener
$actions = $event->getValue('actions');
$actions[] = $sub_action;
$actions[] = $mute_action;
// $actions[] = $sub_action;
// $actions[] = $mute_action;
$event->setValue('actions', $actions);
}

View File

@@ -74,7 +74,7 @@ final class PhabricatorTokenUIEventListener
}
$actions = $event->getValue('actions');
$actions[] = $token_action;
// $actions[] = $token_action;
$event->setValue('actions', $actions);
}

View File

@@ -304,6 +304,7 @@ abstract class PhabricatorApplicationTransactionQuery
protected function newPagingMapFromPartialObject($object) {
return parent::newPagingMapFromPartialObject($object) + array(
'created' => $object->getDateCreated(),
'updated' => $object->getDateModified(),
'phid' => $object->getPHID(),
);
}
@@ -314,6 +315,10 @@ abstract class PhabricatorApplicationTransactionQuery
'vector' => array('created', 'phid'),
'name' => pht('Global'),
),
'updated' => array(
'vector' => array('updated', 'id'),
'name' => pht('Date Updated (Latest First)'),
),
);
}
@@ -324,6 +329,11 @@ abstract class PhabricatorApplicationTransactionQuery
'column' => 'dateCreated',
'type' => 'int',
),
'updated' => array(
'table' => 'x',
'column' => 'dateModified',
'type' => 'int',
),
'phid' => array(
'table' => 'x',
'column' => 'phid',

View File

@@ -833,7 +833,7 @@ abstract class PhabricatorApplicationTransaction
return null;
}
if ($this->hasChangeDetails()) {
if ($this->hasChangeDetails() && false) {
$details_uri = $this->getChangeDetailsURI();
$details_uri = PhabricatorEnv::getProductionURI($details_uri);

View File

@@ -149,6 +149,8 @@ abstract class PhabricatorApplicationTransactionComment
public function shouldUseMarkupCache($field) {
return false;
return (bool)$this->getPHID();
}

View File

@@ -184,6 +184,7 @@ final class PhabricatorApplicationTransactionCommentView
if ($this->getNoPermission()) {
return null;
}
return null;
$lock = $this->getEditEngineLock();
if ($lock) {

View File

@@ -203,7 +203,7 @@ class PhabricatorApplicationTransactionView extends AphrontView {
throw new PhutilInvalidStateException('setObjectPHID');
}
$view = $this->buildPHUITimelineView();
$view = $this->buildPHUITimelineView(false);
if ($this->getShowEditActions()) {
Javelin::initBehavior('phabricator-transaction-list');
@@ -264,9 +264,9 @@ class PhabricatorApplicationTransactionView extends AphrontView {
PhabricatorApplicationTransaction $xaction) {
return javelin_tag(
'a',
'span',
array(
'href' => $xaction->getChangeDetailsURI(),
// 'href' => $xaction->getChangeDetailsURI(),
'sigil' => 'workflow',
),
pht('(Show Details)'));
@@ -274,6 +274,7 @@ class PhabricatorApplicationTransactionView extends AphrontView {
private function buildExtraInformationLink(
PhabricatorApplicationTransaction $xaction) {
return null;
$link = $xaction->renderExtraInformationLink();
if (!$link) {
@@ -438,7 +439,7 @@ class PhabricatorApplicationTransactionView extends AphrontView {
} else {
$title = $xaction->getTitle();
}
if ($xaction->hasChangeDetails()) {
if ($xaction->hasChangeDetails() && false) {
if (!$this->isPreview) {
$details = $this->buildChangeDetailsLink($xaction);
$title = array(

View File

@@ -229,7 +229,7 @@ final class PhabricatorInlineCommentAdjustmentEngine
$diff_id = $changeset->getDiffID();
$inline_id = $inline->getID();
$revision_id = $revision->getID();
$href = "/D{$revision_id}?id={$diff_id}#inline-{$inline_id}";
$href = "D{$revision_id}.id{$diff_id}.html#inline-{$inline_id}";
$inline
->makeEphemeral(true)

View File

@@ -386,6 +386,8 @@ abstract class PhabricatorInlineComment
}
public function shouldUseMarkupCache($field) {
return false;
return !$this->isDraft();
}

View File

@@ -141,7 +141,7 @@ final class PHUIDiffInlineCommentDetailView
array(
'class' => 'ghost-icon',
'href' => $ghost['href'],
'target' => '_blank',
// 'target' => '_blank',
),
$ghost_icon);
$classes[] = 'inline-comment-ghost';
@@ -377,7 +377,7 @@ final class PHUIDiffInlineCommentDetailView
}
$actions = null;
if ($action_buttons || $menu_items) {
if (($action_buttons || $menu_items) && false) {
$actions = new PHUIButtonBarView();
$actions->setBorderless(true);
$actions->addClass('inline-button-divider');

View File

@@ -239,7 +239,7 @@ final class PhabricatorMarkupEngine extends Phobject {
$use_cache = array();
foreach ($objects as $key => $info) {
if ($info['object']->shouldUseMarkupCache($info['field'])) {
$use_cache[$key] = true;
// $use_cache[$key] = true;
}
}

View File

@@ -128,6 +128,8 @@ final class PhabricatorMarkupOneOff
}
public function shouldUseMarkupCache($field) {
return false;
if ($this->getDisableCache()) {
return false;
}

View File

@@ -0,0 +1,21 @@
<?php
function MakeFilemameSafe($file_name) {
return preg_replace('/[^\w\-_\.]/u', '_', $file_name);
}
function PathJoin($parts) {
return join(DIRECTORY_SEPARATOR, $parts);
}
function SubpathFromId($id) {
$padded_id = str_pad($id, 7, '0', STR_PAD_LEFT);
$length = strlen($padded_id);
$bin = substr($padded_id, 0, $length - 3);
return PathJoin(array($bin, $padded_id));
}
?>

View File

@@ -125,7 +125,7 @@ abstract class AphrontView extends Phobject
* @return wild Renderable children.
* @task
*/
final protected function renderChildren() {
final public function renderChildren() {
return $this->children;
}

View File

@@ -65,4 +65,8 @@ final class PHUICurtainObjectRefListView
return $link;
}
public function addTailObject($object) {
$this->tail[] = $object;
}
}

View File

@@ -135,17 +135,17 @@ final class PHUICurtainObjectRefView
if ($image_uri !== null) {
$image_view = javelin_tag(
'a',
'div',
array(
'style' => sprintf('background-image: url(%s)', $image_uri),
'href' => $target_uri,
// 'href' => $target_uri,
'aural' => false,
));
} else if ($icon_view !== null) {
$image_view = javelin_tag(
'a',
'div',
array(
'href' => $target_uri,
// 'href' => $target_uri,
'class' => 'phui-curtain-object-ref-view-icon-image',
'aural' => false,
),

View File

@@ -53,11 +53,11 @@ final class PHUIHeadThingView extends AphrontTagView {
protected function getTagContent() {
$image = javelin_tag(
'a',
'span',
array(
'class' => 'phui-head-thing-image',
'style' => 'background-image: url('.$this->image.');',
'href' => $this->imageHref,
// 'href' => $this->imageHref,
'aural' => false,
));

View File

@@ -178,6 +178,12 @@ final class PHUITagView extends AphrontTagView {
);
}
if ($this->href && substr($this->href, 0, 4) == 'http') {
$attributes += array(
'target' => '_blank',
);
}
return $attributes;
}

View File

@@ -331,12 +331,12 @@ final class PHUITimelineEventView extends AphrontView {
$menu = null;
$items = array();
if (!$this->getIsPreview() && !$this->getHideCommentOptions()) {
foreach ($this->getEventGroup() as $event) {
$items[] = $event->getMenuItems($this->anchor);
}
$items = array_mergev($items);
}
// if (!$this->getIsPreview() && !$this->getHideCommentOptions()) {
// foreach ($this->getEventGroup() as $event) {
// $items[] = $event->getMenuItems($this->anchor);
// }
// $items = array_mergev($items);
// }
if ($items) {
$icon = id(new PHUIIconView())
@@ -413,7 +413,7 @@ final class PHUITimelineEventView extends AphrontView {
if ($event->hasChildren()) {
$group_children[] = $event->renderChildren();
$show_badges = true;
// $show_badges = true;
}
}
@@ -431,11 +431,10 @@ final class PHUITimelineEventView extends AphrontView {
$badges = null;
if ($image_uri) {
$image = javelin_tag(
($this->userHandle->getURI()) ? 'a' : 'div',
'div',
array(
'style' => 'background-image: url('.$image_uri.')',
'class' => 'phui-timeline-image',
'href' => $this->userHandle->getURI(),
'aural' => false,
),
'');

View File

@@ -37,6 +37,11 @@
background: #d0ffd0;
}
.aphront-table-view tr.differential-update-history-current td,
.aphront-table-view tr.alt-differential-update-history-current td {
background: #d0ffd0;
}
.aphront-table-view
.differential-update-history-old-now
td.differential-update-history-old,

View File

@@ -17,7 +17,8 @@
padding-bottom: 24px;
}
.phui-curtain-object-ref-view-image-cell > a {
.phui-curtain-object-ref-view-image-cell > a,
.phui-curtain-object-ref-view-image-cell > div {
height: 24px;
width: 24px;
background-size: 100%;
@@ -58,11 +59,14 @@
}
.phui-curtain-object-ref-view-with-content >
.phui-curtain-object-ref-view-image-cell > a {
.phui-curtain-object-ref-view-image-cell > a,
.phui-curtain-object-ref-view-with-content >
.phui-curtain-object-ref-view-image-cell > div {
margin-top: 4px;
}
.phui-curtain-object-ref-view-title-cell > a {
.phui-curtain-object-ref-view-title-cell > a,
.phui-curtain-object-ref-view-title-cell > div {
color: {$darkgreytext};
}