]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Group.php
post/thread views are renamed, search bugs fixed
[friendica.git] / src / Module / Group.php
index 6767479c3aa5fcb7b5b1ff2aa59734f0e95e70fe..8da062a93e9dfbfb9619725e45e4245164aa23d7 100644 (file)
@@ -1,12 +1,27 @@
 <?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;
 
 use Friendica\BaseModule;
-use Friendica\Core\Config;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
@@ -38,7 +53,6 @@ class Group extends BaseModule
                        $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);
@@ -60,8 +74,8 @@ class Group extends BaseModule
                        }
                        $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.'));
                                }
                        }
                }
@@ -117,7 +131,7 @@ class Group extends BaseModule
                                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());
@@ -146,7 +160,7 @@ class Group extends BaseModule
                // Switch to text mode interface if we have more than 'n' contacts or group members
                $switchtotext = DI::pConfig()->get(local_user(), 'system', 'groupedit_image_limit');
                if (is_null($switchtotext)) {
-                       $switchtotext = Config::get('system', 'groupedit_image_limit', 200);
+                       $switchtotext = DI::config()->get('system', 'groupedit_image_limit', 200);
                }
 
                $tpl = Renderer::getMarkupTemplate('group_edit.tpl');
@@ -201,9 +215,7 @@ class Group extends BaseModule
                                        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.'));
                                }
                        }
@@ -227,7 +239,7 @@ class Group extends BaseModule
                                DI::baseUrl()->redirect('contact');
                        }
 
-                       $members = Model\Contact::getByGroupId($group['id']);
+                       $members = Model\Contact\Group::getById($group['id']);
                        $preselected = [];
 
                        if (count($members)) {
@@ -243,7 +255,7 @@ class Group extends BaseModule
                                        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) {
@@ -304,10 +316,10 @@ class Group extends BaseModule
                }
 
                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);