Addressbook: Fix shared values did not validate

Just passing them along normally now
This commit is contained in:
nathan 2023-02-13 09:46:18 -07:00
parent d15c908e38
commit 7fdadb84bd
2 changed files with 12 additions and 6 deletions

View File

@ -2614,17 +2614,21 @@ class addressbook_ui extends addressbook_bo
}
// set $content[shared_options/_values] from $content[shared]
$content['shared_options'] = [];
$content['shared_values'] = [];
foreach((array)$content['shared'] as $shared)
{
$content['shared_options'][$shared['shared_id'].':'.$shared['shared_with'].':'.$shared['shared_by'].':'.$shared['shared_writable']] = [
$shared_value = $shared['shared_id'] . ':' . $shared['shared_with'] . ':' . $shared['shared_by'] . ':' . $shared['shared_writable'];
$content['shared_values'][] = $shared_value;
$sel_options['shared_values'][] = [
'value' => $shared_value,
'label' => Api\Accounts::username($shared['shared_with']),
'title' => lang('%1 shared this contact on %2 with %3 %4',
Api\Accounts::username($shared['shared_by']), Api\DateTime::to($shared['shared_at']),
Api\Accounts::username($shared['shared_with']), $shared['shared_writable'] ? lang('writable') : lang('readonly')),
'icon' => $shared['shared_writable'] ? 'edit' : 'view',
Api\Accounts::username($shared['shared_by']), Api\DateTime::to($shared['shared_at']),
Api\Accounts::username($shared['shared_with']), $shared['shared_writable'] ? lang('writable') : lang('readonly')
),
'icon' => $shared['shared_writable'] ? 'edit' : 'view',
];
}
$content['shared_values'] = array_keys($content['shared_options']);
// disable shared with UI for non-SQL backends
$content['shared_disabled'] = !is_a($this->get_backend($content['id'], $content['owner']), Api\Contacts\Sql::class);

View File

@ -130,7 +130,9 @@
<et2-description for="shared" value="Shared with"></et2-description>
<et2-checkbox id="shared_writable" label="writable" statustext="Create new shares writable"></et2-checkbox>
</et2-vbox>
<et2-select-account id="shared_values" multiple="true" span="all" onchange="app.addressbook.shared_changed" accountType="both" selectOptions="@shared_options"></et2-select-account>
<et2-select-account id="shared_values" multiple="true" span="all"
onchange="app.addressbook.shared_changed"
accountType="both"></et2-select-account>
</row>
</rows>
</grid>