Skip to content

Commit 9a812ed

Browse files
authored
Mooay 2022 Update – The Tag Update | Revision B (2022-05b)
This PR adds some API Fixes and one UI Fix (improvement)
2 parents 43d2a6e + 5839e22 commit 9a812ed

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

data/web/css/build/008-mailcow.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ table.footable>tbody>tr.footable-empty>td {
232232
font-style:italic;
233233
font-size: 1rem;
234234
}
235+
table>tbody>tr>td>span.footable-toggle {
236+
opacity: 0.75;
237+
}
235238
.navbar-nav > li {
236239
font-size: 1rem !important;
237240
}
@@ -292,4 +295,5 @@ code {
292295
padding: 0 5px 0 5px;
293296
align-items: center;
294297
display: inline-flex;
295-
}
298+
}
299+

data/web/inc/functions.mailbox.inc.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
568568
));
569569
// save tags
570570
foreach($tags as $index => $tag){
571+
if (empty($tag)) continue;
571572
if ($index > $GLOBALS['TAGGING_LIMIT']) {
572573
$_SESSION['return'][] = array(
573574
'type' => 'warning',
@@ -1124,6 +1125,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
11241125
));
11251126
// save tags
11261127
foreach($tags as $index => $tag){
1128+
if (empty($tag)) continue;
11271129
if ($index > $GLOBALS['TAGGING_LIMIT']) {
11281130
$_SESSION['return'][] = array(
11291131
'type' => 'warning',
@@ -2201,8 +2203,9 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
22012203
':gal' => $gal,
22022204
':domain' => $domain
22032205
));
2204-
// save tags, tag_name is unique
2206+
// save tags
22052207
foreach($tags as $index => $tag){
2208+
if (empty($tag)) continue;
22062209
if ($index > $GLOBALS['TAGGING_LIMIT']) {
22072210
$_SESSION['return'][] = array(
22082211
'type' => 'warning',
@@ -2368,8 +2371,9 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
23682371
':description' => $description,
23692372
':domain' => $domain
23702373
));
2371-
// save tags, tag_name is unique
2374+
// save tags
23722375
foreach($tags as $index => $tag){
2376+
if (empty($tag)) continue;
23732377
if ($index > $GLOBALS['TAGGING_LIMIT']) {
23742378
$_SESSION['return'][] = array(
23752379
'type' => 'warning',
@@ -2712,6 +2716,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
27122716
));
27132717
// save tags
27142718
foreach($tags as $index => $tag){
2719+
if (empty($tag)) continue;
27152720
if ($index > $GLOBALS['TAGGING_LIMIT']) {
27162721
$_SESSION['return'][] = array(
27172722
'type' => 'warning',

data/web/js/build/014-mailcow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ $(document).ready(function() {
290290
var tagValuesElem = $(tagboxElem).find(".tag-values")[0];
291291

292292
var tag = escapeHtml($(tagInputElem).val());
293+
if (!tag) return;
293294
var value_tags = [];
294295
try {
295296
value_tags = JSON.parse($(tagValuesElem).val());

data/web/json_api.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -989,14 +989,19 @@ function process_get_return($data, $object = true) {
989989
if (isset($_GET['tags']) && $_GET['tags'] != '')
990990
$tags = explode(',', $_GET['tags']);
991991

992-
$mailboxes = mailbox('get', 'mailboxes', $object, $tags);
993-
if (!empty($mailboxes)) {
994-
foreach ($mailboxes as $mailbox) {
995-
if ($details = mailbox('get', 'mailbox_details', $mailbox)) $data[] = $details;
996-
else continue;
992+
if ($tags === null) {
993+
$data = mailbox('get', 'mailbox_details', $object);
994+
process_get_return($data);
995+
} else {
996+
$mailboxes = mailbox('get', 'mailboxes', $object, $tags);
997+
if (is_array($mailboxes)) {
998+
foreach ($mailboxes as $mailbox) {
999+
if ($details = mailbox('get', 'mailbox_details', $mailbox))
1000+
$data[] = $details;
1001+
}
9971002
}
1003+
process_get_return($data, false);
9981004
}
999-
process_get_return($data);
10001005
break;
10011006
}
10021007
break;

0 commit comments

Comments
 (0)