Skip to content

Commit

Permalink
Add external_uuid column to Contact/Contactgroup model
Browse files Browse the repository at this point in the history
Only show this column in the search column suggestions if explicitly specified
  • Loading branch information
sukhwinder33445 committed Jun 13, 2024
1 parent cc24232 commit 5c4fc70
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions library/Notifications/Model/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ public function getColumns(): array
return [
'full_name',
'username',
'default_channel_id'
'default_channel_id',
'external_uuid'
];
}

public function getColumnDefinitions()
{
return [
'full_name' => t('Full Name'),
'username' => t('Username')
'full_name' => t('Full Name'),
'username' => t('Username'),
'external_uuid' => t('UUID')
];
}

Expand Down
8 changes: 6 additions & 2 deletions library/Notifications/Model/Contactgroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ public function getKeyName(): string
public function getColumns(): array
{
return [
'name'
'name',
'external_uuid'
];
}

public function getColumnDefinitions(): array
{
return ['name' => t('Name')];
return [
'name' => t('Name'),
'external_uuid' => t('UUID')
];
}

public function getSearchColumns(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected function queryTags(Model $model, string $searchTerm): Query

protected function matchSuggestion($path, $label, $searchTerm)
{
if (preg_match('/[_.](id)$/', $path)) {
if (preg_match('/[_.](id|uuid)$/', $path)) {
// Only suggest exotic columns if the user knows about them
$trimmedSearch = trim($searchTerm, ' *');
return substr($path, -strlen($trimmedSearch)) === $trimmedSearch;
Expand Down

0 comments on commit 5c4fc70

Please sign in to comment.