mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 04:50:55 +01:00
Add author field to image macro display
Summary: this is a request from Facebook: > someone has added macros for common words like 'push', 'lgtm'. > We want to let he image macro page at least attribute to an owner so > that we can publicly shame whoever added the 800px 'clowntown' macro. Test Plan: test macros with/without author (all macro should have author. This is just to be safe). Reviewers: epriestley, nh Reviewed By: epriestley CC: hwang, aran, arice, jungejason, epriestley Differential Revision: 984
This commit is contained in:
parent
a8519c6837
commit
ce8799176e
2 changed files with 20 additions and 0 deletions
|
@ -42,9 +42,22 @@ class PhabricatorFileMacroListController extends PhabricatorFileController {
|
||||||
$pager->setCount($count);
|
$pager->setCount($count);
|
||||||
$pager->setURI($request->getRequestURI(), 'page');
|
$pager->setURI($request->getRequestURI(), 'page');
|
||||||
|
|
||||||
|
$file_phids = mpull($macros, 'getFilePHID');
|
||||||
|
$files = id(new PhabricatorFile())->loadAllWhere(
|
||||||
|
"phid IN (%Ls)",
|
||||||
|
$file_phids);
|
||||||
|
$author_phids = mpull($files, 'getAuthorPHID', 'getPHID');
|
||||||
|
$handles = id(new PhabricatorObjectHandleData($author_phids))
|
||||||
|
->loadHandles();
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($macros as $macro) {
|
foreach ($macros as $macro) {
|
||||||
$src = PhabricatorFileURI::getViewURIForPHID($macro->getFilePHID());
|
$src = PhabricatorFileURI::getViewURIForPHID($macro->getFilePHID());
|
||||||
|
$file_phid = $macro->getFilePHID();
|
||||||
|
$author_link = isset($author_phids[$file_phid])
|
||||||
|
? $handles[$author_phids[$file_phid]]->renderLink()
|
||||||
|
: null;
|
||||||
|
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
phutil_render_tag(
|
phutil_render_tag(
|
||||||
'a',
|
'a',
|
||||||
|
@ -52,6 +65,8 @@ class PhabricatorFileMacroListController extends PhabricatorFileController {
|
||||||
'href' => '/file/macro/edit/'.$macro->getID().'/',
|
'href' => '/file/macro/edit/'.$macro->getID().'/',
|
||||||
),
|
),
|
||||||
phutil_escape_html($macro->getName())),
|
phutil_escape_html($macro->getName())),
|
||||||
|
|
||||||
|
$author_link,
|
||||||
phutil_render_tag(
|
phutil_render_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
|
@ -78,12 +93,14 @@ class PhabricatorFileMacroListController extends PhabricatorFileController {
|
||||||
$table->setHeaders(
|
$table->setHeaders(
|
||||||
array(
|
array(
|
||||||
'Name',
|
'Name',
|
||||||
|
'Author',
|
||||||
'Image',
|
'Image',
|
||||||
'',
|
'',
|
||||||
));
|
));
|
||||||
$table->setColumnClasses(
|
$table->setColumnClasses(
|
||||||
array(
|
array(
|
||||||
'pri',
|
'pri',
|
||||||
|
'',
|
||||||
'wide thumb',
|
'wide thumb',
|
||||||
'action',
|
'action',
|
||||||
));
|
));
|
||||||
|
|
|
@ -7,8 +7,10 @@
|
||||||
|
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'applications/files/controller/base');
|
phutil_require_module('phabricator', 'applications/files/controller/base');
|
||||||
|
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||||
phutil_require_module('phabricator', 'applications/files/storage/imagemacro');
|
phutil_require_module('phabricator', 'applications/files/storage/imagemacro');
|
||||||
phutil_require_module('phabricator', 'applications/files/uri');
|
phutil_require_module('phabricator', 'applications/files/uri');
|
||||||
|
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||||
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||||
phutil_require_module('phabricator', 'storage/queryfx');
|
phutil_require_module('phabricator', 'storage/queryfx');
|
||||||
phutil_require_module('phabricator', 'view/control/pager');
|
phutil_require_module('phabricator', 'view/control/pager');
|
||||||
|
@ -16,6 +18,7 @@ phutil_require_module('phabricator', 'view/control/table');
|
||||||
phutil_require_module('phabricator', 'view/layout/panel');
|
phutil_require_module('phabricator', 'view/layout/panel');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'markup');
|
phutil_require_module('phutil', 'markup');
|
||||||
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
||||||
|
|
||||||
phutil_require_source('PhabricatorFileMacroListController.php');
|
phutil_require_source('PhabricatorFileMacroListController.php');
|
||||||
|
|
Loading…
Reference in a new issue