<?php
/**
- * @file src/Module/Group.php
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
*/
namespace Friendica\Module;
$name = Strings::escapeTags(trim($_POST['groupname']));
$r = Model\Group::create(local_user(), $name);
if ($r) {
- info(DI::l10n()->t('Group created.'));
$r = Model\Group::getIdByName(local_user(), $name);
if ($r) {
DI::baseUrl()->redirect('group/' . $r);
}
$groupname = Strings::escapeTags(trim($_POST['groupname']));
if (strlen($groupname) && ($groupname != $group['name'])) {
- if (Model\Group::update($group['id'], $groupname)) {
- info(DI::l10n()->t('Group name changed.'));
+ if (!Model\Group::update($group['id'], $groupname)) {
+ notice(DI::l10n()->t('Group name was not changed.'));
}
}
}
throw new \Exception(DI::l10n()->t('Bad request.'), 400);
}
- notice($message);
+ info($message);
System::jsonExit(['status' => 'OK', 'message' => $message]);
} catch (\Exception $e) {
notice($e->getMessage());
DI::baseUrl()->redirect('contact');
}
- if (Model\Group::remove($a->argv[2])) {
- info(DI::l10n()->t('Group removed.'));
- } else {
+ if (!Model\Group::remove($a->argv[2])) {
notice(DI::l10n()->t('Unable to remove group.'));
}
}
DI::baseUrl()->redirect('contact');
}
- $members = Model\Contact::getByGroupId($group['id']);
+ $members = Model\Contact\Group::getById($group['id']);
$preselected = [];
if (count($members)) {
Model\Group::addMember($group['id'], $change);
}
- $members = Model\Contact::getByGroupId($group['id']);
+ $members = Model\Contact\Group::getById($group['id']);
$preselected = [];
if (count($members)) {
foreach ($members as $member) {
}
if ($nogroup) {
- $contacts = Model\Contact::getUngroupedList(local_user());
+ $contacts = Model\Contact\Group::listUngrouped(local_user());
} else {
$contacts_stmt = DBA::select('contact', [],
- ['uid' => local_user(), 'pending' => false, 'blocked' => false, 'self' => false],
+ ['uid' => local_user(), 'pending' => false, 'blocked' => false, 'failed' => false, 'self' => false],
['order' => ['name']]
);
$contacts = DBA::toArray($contacts_stmt);