Add contact removal from all groups when blocked

This commit is contained in:
Hypolite Petovan 2019-02-23 15:26:06 -05:00
parent 7e499647e3
commit b939faf4ef

View File

@ -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]);
}
}