[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Tiki-Cypht: Disallow move tracker item email to same folder
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a7b3bda60cf1_3856ca00c77274@gitlab-sidekiq-low-urgency-cpu-bound-v2-84dcc76b6c-hk8r6.mail> |
Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
5747b652 by Josaphat Imani at 2026-08-11T14:55:17+00:00
[FIX] Tiki-Cypht: Disallow move tracker item email to same folder
---
* [FIX] Tiki-Cypht: Disallow move tracker item email to same folder
See merge request tikiwiki/tiki!10135
- - - - -
4 changed files:
- lib/cypht/modules/tiki/js_modules/utils/moveToTracker.utils.js
- lib/cypht/modules/tiki/setup.php
- lib/cypht/modules/tiki/site.js
- lib/cypht/modules/tiki/tracker_modules.php
Changes:
=====================================
lib/cypht/modules/tiki/js_modules/utils/moveToTracker.utils.js
=====================================
@@ -32,6 +32,15 @@ async function handleItemClick(modal, msgUid, listPath, chooseFolder = false, on
}
}
+ if (isTrackerPath()) {
+ const m = listPath.match(/tracker_folder_(\d+)_(\d+)/);
+
+ if (itemId == m[1] && fieldId == m[2] && trk_item_email_folder == folder) {
+ alert(tr("This message is already in the selected tracker item and folder."));
+ return;
+ }
+ }
+
const autoMove = await promptFutureReplyAutoMove();
modal.tikiModal(tr("Loading..."));
@@ -64,13 +73,15 @@ async function showFolderPicker(itemElement) {
// close any existing dropdowns
itemElement.closest(".modal").find(".dropdown-menu.show").each(function () {
- bootstrap.Dropdown.getInstance(this)?.hide();
+ if ($(this)[0] !== dropdown[0]) {
+ $(this).removeClass("show");
+ }
});
- bootstrap.Dropdown.getOrCreateInstance(dropdown[0], {
+ bootstrap.Dropdown.getOrCreateInstance(itemElement[0], {
autoClose: 'outside',
display: 'static',
- }).show();
+ }).toggle();
if (dropdown.find(".dropdown-item").length) {
return;
=====================================
lib/cypht/modules/tiki/setup.php
=====================================
@@ -308,6 +308,7 @@ return [
'restore_error' => [FILTER_VALIDATE_BOOLEAN, false],
'show_archive' => [FILTER_VALIDATE_BOOLEAN, false],
'show_restore' => [FILTER_VALIDATE_BOOLEAN, false],
+ 'msg_current_folder' => [FILTER_SANITIZE_FULL_SPECIAL_CHARS, false],
'flag_state' => [FILTER_SANITIZE_FULL_SPECIAL_CHARS, false],
'trackers' => [FILTER_DEFAULT, false],
'tracker_data' => [FILTER_DEFAULT, false],
=====================================
lib/cypht/modules/tiki/site.js
=====================================
@@ -455,7 +455,7 @@ var tiki_get_message_content = function(msg_part, uid, images) {
$('.msg_text').append(res.msg_parts);
document.title = $('.header_subject th').text();
imap_message_view_finished();
- tiki_message_view_finished(res.show_archive, res.show_restore);
+ tiki_message_view_finished(res.show_archive, res.show_restore, res.msg_current_folder);
tiki_prev_next_links(res.msg_prev_link, res.msg_prev_subject, res.msg_next_link, res.msg_next_subject);
window.dispatchEvent(new CustomEvent('message-loaded'));
},
@@ -466,7 +466,9 @@ var tiki_get_message_content = function(msg_part, uid, images) {
return false;
};
-var tiki_message_view_finished = function(show_archive, show_restore) {
+var trk_item_email_folder;
+
+var tiki_message_view_finished = function(show_archive, show_restore, current_folder) {
$('.msg_part_link').off("click").on("click", function() {
$('.header_subject')[0].scrollIntoView();
$('.msg_text_inner').css('visibility', 'hidden');
@@ -493,6 +495,10 @@ var tiki_message_view_finished = function(show_archive, show_restore) {
$('#archive_message').remove();
}
+ if (typeof current_folder !== 'undefined') {
+ trk_item_email_folder = current_folder;
+ }
+
$('#unread_message').off('click').on("click", function() { return tiki_unread_message();});
$('#delete_message').parent().contents().filter(function() { return this.nodeType == 3 && this.previousSibling.nodeType == 3; }).remove();
};
=====================================
lib/cypht/modules/tiki/tracker_modules.php
=====================================
@@ -859,8 +859,22 @@ class Hm_Handler_tiki_message_content extends Hm_Handler_Module
}
$this->out('show_archive', $email['show_archive']);
- if (preg_match("/tracker_folder_(\d+)_(\d+)/", $this->request->post['list_path'], $m) && $email['is_tiki_tracker_trash_folder']) {
- $this->out('show_restore', true);
+ if (preg_match("/tracker_folder_(\d+)_(\d+)/", $this->request->post['list_path'], $m)) {
+ $trklib = TikiLib::lib('trk');
+ $uid = $this->request->get['uid'];
+ $value = $trklib->get_item_value(null, $m[1], $m[2]);
+ $value = json_decode($value, true);
+
+ foreach ($value as $folder => $emailIds) {
+ if (in_array($uid, $emailIds)) {
+ $this->out('msg_current_folder', $folder);
+ break;
+ }
+ }
+
+ if ($email['is_tiki_tracker_trash_folder']) {
+ $this->out('show_restore', true);
+ }
}
clear_existing_reply_details($this->session);
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5747b652bd7037e0c2408bb13f71b42b6a91c500
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5747b652bd7037e0c2408bb13f71b42b6a91c500
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs