mirror of
https://github.com/friendica/friendica
synced 2025-04-26 22:30:18 +00:00
Merge pull request #6732 from MrPetovan/bug/1777-fix-blocked-contact-group
Allow to remove blocked contact from groups
This commit is contained in:
commit
df5ea1fab0
10 changed files with 406 additions and 372 deletions
|
@ -232,6 +232,11 @@ class Contact extends BaseObject
|
|||
}
|
||||
|
||||
DBA::update('user-contact', ['blocked' => $blocked], ['cid' => $cdata['public'], 'uid' => $uid], true);
|
||||
|
||||
if ($blocked) {
|
||||
// Blocked contact can't be in any group
|
||||
self::removeFromGroups($cid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2220,4 +2225,9 @@ class Contact extends BaseObject
|
|||
|
||||
return $redirect;
|
||||
}
|
||||
|
||||
public static function removeFromGroups($contact_id)
|
||||
{
|
||||
return DBA::delete('group_member', ['contact-id' => $contact_id]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,26 @@ use Friendica\Database\DBA;
|
|||
*/
|
||||
class Group extends BaseObject
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param int $group_id
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function exists($group_id, $uid = null)
|
||||
{
|
||||
$condition = ['id' => $group_id, 'deleted' => false];
|
||||
|
||||
if (isset($uid)) {
|
||||
$condition = [
|
||||
'uid' => $uid
|
||||
];
|
||||
}
|
||||
|
||||
return DBA::exists('group', $condition);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a new contact group
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue