Merge pull request #8063 from MrPetovan/bug/8058-use-default-user-acl-events

Use default user permissions when creating new event
This commit is contained in:
Philipp 2020-01-06 14:18:20 +01:00 committed by GitHub
commit e56c8dcc3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 51 deletions

View file

@ -2682,26 +2682,23 @@ class Contact
* Remove the unavailable contact ids from the provided list
*
* @param array $contact_ids Contact id list
* @return array
* @throws \Exception
*/
public static function pruneUnavailable(array &$contact_ids)
public static function pruneUnavailable(array $contact_ids)
{
if (empty($contact_ids)) {
return;
return [];
}
$str = DBA::escape(implode(',', $contact_ids));
$contacts = Contact::selectToArray(['id'], [
'id' => $contact_ids,
'blocked' => false,
'pending' => false,
'archive' => false,
]);
$stmt = DBA::p("SELECT `id` FROM `contact` WHERE `id` IN ( " . $str . ") AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0");
$return = [];
while($contact = DBA::fetch($stmt)) {
$return[] = $contact['id'];
}
DBA::close($stmt);
$contact_ids = $return;
return array_column($contacts, 'id');
}
/**

View file

@ -384,7 +384,7 @@ class Group
DBA::close($stmt);
if ($check_dead) {
Contact::pruneUnavailable($return);
$return = Contact::pruneUnavailable($return);
}
return $return;