- $contact = DBA::selectFirst('contact', ['pending', 'blocked', 'deleted'], ['id' => $contact_id, 'uid' => local_user()]);
+ $contact = DBA::selectFirst('contact', ['deleted'], ['id' => $contact_id, 'uid' => local_user()]);
if (!DBA::isResult($contact)) {
throw new \Exception(L10n::t('Contact not found.'), 404);
}
if (!DBA::isResult($contact)) {
throw new \Exception(L10n::t('Contact not found.'), 404);
}
if ($contact['deleted']) {
throw new \Exception(L10n::t('Contact is deleted.'), 410);
}
switch($command) {
case 'add':
if ($contact['deleted']) {
throw new \Exception(L10n::t('Contact is deleted.'), 410);
}
switch($command) {
case 'add':
if (!Model\Group::addMember($group_id, $contact_id)) {
throw new \Exception(L10n::t('Unable to add the contact to the group.'), 500);
}
if (!Model\Group::addMember($group_id, $contact_id)) {
throw new \Exception(L10n::t('Unable to add the contact to the group.'), 500);
}
$message = L10n::t('Contact successfully added to group.');
break;
case 'remove':
if (!Model\Group::removeMember($group_id, $contact_id)) {
throw new \Exception(L10n::t('Unable to remove the contact from the group.'), 500);
}
$message = L10n::t('Contact successfully added to group.');
break;
case 'remove':
if (!Model\Group::removeMember($group_id, $contact_id)) {
throw new \Exception(L10n::t('Unable to remove the contact from the group.'), 500);
}