Skip to content

Commit

Permalink
Update upload.main.js
Browse files Browse the repository at this point in the history
Removed Insert private attachment as this doesn't work. Inserted private attachments are still visible for everyone.
Buttons are now ok.
  • Loading branch information
Pinkeltje authored Nov 8, 2024
1 parent 17266c1 commit baa33f1
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions src/media/kunena/core/js/upload.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,42 +240,7 @@ jQuery(function ($) {
filesedit = null;
});

const setPrivateButton = $('<button>')
.addClass("btn btn-primary")
.html(Joomla.getOptions('com_kunena.icons.secure') + ' ' + Joomla.Text._('COM_KUNENA_EDITOR_INSERT_PRIVATE_ATTACHMENT'))
.on('click', function (e) {
// Make sure the button click doesn't submit the form:
e.preventDefault();
e.stopPropagation();

const $this = $(this),
data = $this.data();

let file_id = 0;
let filename = null;
if (data.result !== undefined) {
file_id = data.result.data.id;
filename = data.result.data.filename;
} else {
file_id = data.id;
filename = data.name;
}

const files_id = [];
files_id.push(file_id);

$.ajax({
url: Joomla.getOptions('com_kunena.kunena_upload_files_set_private') + '&files_id=' + JSON.stringify(files_id),
type: 'POST'
})
.done(function (data) {

})
.fail(function () {
//TODO: handle the error of ajax request
});
});


const insertButton = $('<button>')
.addClass("btn btn-primary")
.html(Joomla.getOptions('com_kunena.icons.upload') + ' ' + Joomla.Text._('COM_KUNENA_EDITOR_INSERT'))
Expand Down

0 comments on commit baa33f1

Please sign in to comment.