1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Drag & Drop: fix JavaScript error related to JX.$(undefined)

Summary:
This change fixes the following recent JavaScript error:

    Error: Empty ID passed to JX.$()!

The regression was introduced here:

90f9da643d

Closes T15272

Test Plan: - with this change I was able to open Conpherence Persistent Chat and Drop a file

Reviewers: O1 Blessed Committers, Dylsss, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: Dylsss, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15272

Differential Revision: https://we.phorge.it/D25134
This commit is contained in:
Valerio Bozzolan 2023-04-26 09:49:35 +02:00
parent a89b4ff5b8
commit 7bd4089a26

View file

@ -27,11 +27,15 @@ JX.behavior('aphront-drag-and-drop-textarea', function(config) {
drop.listen('didUpload', function(file) { drop.listen('didUpload', function(file) {
JX.TextAreaUtils.insertFileReference(target, file); JX.TextAreaUtils.insertFileReference(target, file);
if(config.remarkupMetadataID) {
// Try to auto-attach files by default
// https://we.phorge.it/T15106
var metadata = new JX.RemarkupMetadata(config.remarkupMetadataValue, var metadata = new JX.RemarkupMetadata(config.remarkupMetadataValue,
config.remarkupMetadataID); config.remarkupMetadataID);
var phids = metadata.getMetadata('attachedFilePHIDs', []); var phids = metadata.getMetadata('attachedFilePHIDs', []);
phids.push(file.getPHID()); phids.push(file.getPHID());
metadata.setMetadata('attachedFilePHIDs', phids); metadata.setMetadata('attachedFilePHIDs', phids);
}
}); });
drop.start(); drop.start();