* Mail: Config setting for how many mailing lists are returned in address search results

This commit is contained in:
nathangray 2020-12-14 09:34:17 -07:00
parent 487e2413ae
commit 77d195bd9c
2 changed files with 9 additions and 4 deletions

View File

@ -3586,7 +3586,7 @@ class mail_compose
$contacts_obj = new Api\Contacts(); $contacts_obj = new Api\Contacts();
$results = array(); $results = array();
// Add up to 10 matching mailing lists, and 10 groups // Add some matching mailing lists, and some groups, limited by config
if($include_lists) if($include_lists)
{ {
$results += static::get_lists($_searchString, $contacts_obj); $results += static::get_lists($_searchString, $contacts_obj);
@ -3715,7 +3715,7 @@ class mail_compose
/** /**
* Get list of matching distribution lists when searching for email addresses * Get list of matching distribution lists when searching for email addresses
* *
* The results are limited to 10 each of group lists and normal lists * The results are limited by config setting. Default 10 each of group lists and normal lists
* *
* @param String $_searchString * @param String $_searchString
* @param Contacts $contacts_obj * @param Contacts $contacts_obj
@ -3745,8 +3745,9 @@ class mail_compose
); );
${"${type}_lists"}[] = $list; ${"${type}_lists"}[] = $list;
} }
$trim = function($list) { $config = Api\Config::read('mail');
$limit = 10; $limit = $config['address_list_limit'] ?: 10;
$trim = function($list) use ($limit) {
if(count($list) <= $limit) return $list; if(count($list) <= $limit) return $list;
$list[$limit-1]['class'].= ' more_results'; $list[$limit-1]['class'].= ' more_results';
$list[$limit-1]['title'] .= ' (' . lang('%1 more', count($list) - $limit) . ')'; $list[$limit-1]['title'] .= ' (' . lang('%1 more', count($list) - $limit) . ')';

View File

@ -83,6 +83,10 @@
<description value="Miscellaneous" span="all" class="subHeader"/> <description value="Miscellaneous" span="all" class="subHeader"/>
</row> </row>
<row> <row>
<description value="Limit mailing list results when searching for addresses"/>
<integer max="100" min="5" id="newsettings[address_list_limit]"/>
</row>
<row>
<description value="Default toolbar actions shown in mail's HTML editor"/> <description value="Default toolbar actions shown in mail's HTML editor"/>
<taglist id="newsettings[html_toolbar]" allowFreeEntries="false" autocomplete_url='' editModeEnabled="false"/> <taglist id="newsettings[html_toolbar]" allowFreeEntries="false" autocomplete_url='' editModeEnabled="false"/>
</row> </row>