From 4f356838beda6e03bbb05c94144cbc2df25ed38e Mon Sep 17 00:00:00 2001 From: Valerio Bozzolan Date: Fri, 17 Mar 2023 08:29:35 +0100 Subject: [PATCH] FileUpload: show File page instead of binary file Summary: This modification improves a single link shown to the user. The goal is to make it easier to change file permissions or file name or whatever just after the upload of the file itself. Before this change, doing that was difficult because clicking on the popup would send you back to the binary file only. Closes T15165 Test Plan: - upload a file using drag & drop (for example in a comment) - click on the popup's link - you see the File page, not the binary file Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15165 Differential Revision: https://we.phorge.it/D25074 --- webroot/rsrc/js/core/FileUpload.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/webroot/rsrc/js/core/FileUpload.js b/webroot/rsrc/js/core/FileUpload.js index 22ba33f97a..e2c3530cbd 100644 --- a/webroot/rsrc/js/core/FileUpload.js +++ b/webroot/rsrc/js/core/FileUpload.js @@ -38,6 +38,20 @@ JX.install('PhabricatorFileUpload', { return this; }, + /** + * Get the File Monogram - like 'F123' + */ + getMonogram: function() { + return 'F' + this.getID(); + }, + + /** + * Get the File page URI - like '/F123' + */ + getPageURI: function() { + return '/' + this.getMonogram(); + }, + setChunks: function(chunks) { var chunk; for (var ii = 0; ii < chunks.length; ii++) { @@ -101,7 +115,7 @@ JX.install('PhabricatorFileUpload', { switch (this.getStatus()) { case 'done': - var link = JX.$N('a', {href: this.getURI()}, 'F' + this.getID()); + var link = JX.$N('a', {href: this.getPageURI()}, this.getMonogram()); content = [ JX.$N('strong', {}, ['Upload Complete (', link, ')']),