Consolidate Macro loading
Summary: Fixes T2820 Grepped for `PhabricatorFileImageMacro`, a common approach to load image macros from storage. Cleaned up file loading too (in most cases where I could be sure that I won't break anything). Did not touch the `add_macro.php` util script, since many users will assume the user `ubuntu` or `ec2-user` to run the script. Add no sessions and no CSRF protection measures... Test Plan: Browsed around all kinds of places. Created and looked at memes, created and edited macros. Used them in Remarkup (with flushed cache). Used `macro.query`, verified it did not crash (that's always a good sign). Could not verify object handles, since I have no idea where they appear right now. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2820 Differential Revision: https://secure.phabricator.com/D5418
This commit is contained in:
committed by
epriestley
parent
15c9287d43
commit
f95710e799
@@ -9,14 +9,14 @@ final class PhabricatorMacroMemeController
|
||||
$upper_text = $request->getStr('uppertext');
|
||||
$lower_text = $request->getStr('lowertext');
|
||||
$user = $request->getUser();
|
||||
$macro = id(new PhabricatorFileImageMacro())
|
||||
->loadOneWhere('name=%s', $macro_name);
|
||||
$macro = id(new PhabricatorMacroQuery())
|
||||
->setViewer($user)
|
||||
->withNames(array($macro_name))
|
||||
->executeOne();
|
||||
if (!$macro) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
$file = id(new PhabricatorFile())->loadOneWhere(
|
||||
'phid = %s',
|
||||
$macro->getFilePHID());
|
||||
$file = $macro->getFile();
|
||||
|
||||
$upper_text = strtoupper($upper_text);
|
||||
$lower_text = strtoupper($lower_text);
|
||||
|
||||
Reference in New Issue
Block a user