Skip to content

Commit

Permalink
Merge pull request #4230 from corentin-soriano/delete_items_in_list
Browse files Browse the repository at this point in the history
BUGFIX - Correct issues in delete items in list
  • Loading branch information
nilsteampassnet authored Aug 25, 2024
2 parents 43c12a6 + 0203d7a commit f1acaa1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions pages/items.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -1459,8 +1459,6 @@ function(data) {

// Refresh tree
refreshTree(folderId, true);
// Load list of items
ListerItems(folderId, '', 0);
// Close
if (closeItemCard === true) {
closeItemDetailsCard();
Expand Down Expand Up @@ -2346,15 +2344,15 @@ function(teampassItem) {
event.preventDefault();
// Delete item
if (debugJavascript === true) {
console.info('SHOW DELETE ITEM '+$(this).data('item-key'));
console.info('SHOW DELETE ITEM '+$(this).data('item-id'));
}
startedItemsListQuery = false;

// check if user still has access
var itemKeyToDelete = $(this).data('item-key');
var itemIdToDelete = $(this).data('item-id');

$.when(
checkAccess($(this).data('item-key'), selectedFolderId, <?php echo $session->get('user-id'); ?>, 'delete')
checkAccess($(this).data('item-id'), selectedFolderId, <?php echo $session->get('user-id'); ?>, 'delete')
).then(function(retData) {
// Is the user allowed?
if (retData.access === false || retData.delete === false) {
Expand Down Expand Up @@ -2390,8 +2388,8 @@ function(teampassItem) {
event2.preventDefault();

goDeleteItem(
itemIdToDelete,
'',
itemKeyToDelete,
selectedFolderId,
'',
false
Expand Down Expand Up @@ -4268,7 +4266,7 @@ function(teampassApplication) {
}

// Trash icon
trash_link = '<span class="fa-stack fa-clickable warn-user pointer infotip mr-2 list-item-clicktodelete" title="<?php echo $lang->get('delete'); ?>" data-item-key="' + value.item_key + '"><i class="fa-solid fa-circle fa-stack-2x"></i><i class="fa-solid fa-trash fa-stack-1x fa-inverse"></i></span>';
trash_link = '<span class="fa-stack fa-clickable warn-user pointer infotip mr-2 list-item-clicktodelete" title="<?php echo $lang->get('delete'); ?>" data-item-id="' + value.item_id + '"><i class="fa-solid fa-circle fa-stack-2x"></i><i class="fa-solid fa-trash fa-stack-1x fa-inverse"></i></span>';

// Prepare Description
if (value.desc !== '') {
Expand Down

0 comments on commit f1acaa1

Please sign in to comment.