From b4b8c61daf75fc16f2c51baf10c15792f6ace788 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 2 May 2019 10:20:02 -0400 Subject: [PATCH] Add @TODO comments per @nupplaphil review in various Admin modules --- src/Module/Admin/Queue.php | 1 + src/Module/Admin/Site.php | 1 + src/Module/Admin/Users.php | 8 ++++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Module/Admin/Queue.php b/src/Module/Admin/Queue.php index 748a12a6a..e89aa53c6 100644 --- a/src/Module/Admin/Queue.php +++ b/src/Module/Admin/Queue.php @@ -39,6 +39,7 @@ class Queue extends BaseAdminModule $info = L10n::t('This page lists the currently queued worker jobs. These jobs are handled by the worker cronjob you\'ve set up during install.'); } + // @TODO Move to Model\WorkerQueue::getEntries() $entries = DBA::select('workerqueue', ['id', 'parameter', 'created', 'priority'], $condition, ['order' => ['priority']]); $r = []; diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index 37507ca99..5d2004ca5 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -483,6 +483,7 @@ class Site extends BaseAdminModule ]; /* get user names to make the install a personal install of X */ + // @TODO Move to Model\User::getNames() $user_names = []; $user_names['---'] = L10n::t('Multi user instance'); diff --git a/src/Module/Admin/Users.php b/src/Module/Admin/Users.php index d9852e98d..92dddd9f7 100644 --- a/src/Module/Admin/Users.php +++ b/src/Module/Admin/Users.php @@ -91,11 +91,13 @@ class Users extends BaseAdminModule } if (!empty($_POST['page_users_block'])) { + // @TODO Move this to Model\User:block($users); DBA::update('user', ['blocked' => 1], ['uid' => $users]); notice(L10n::tt('%s user blocked', '%s users blocked', count($users))); } if (!empty($_POST['page_users_unblock'])) { + // @TODO Move this to Model\User:unblock($users); DBA::update('user', ['blocked' => 0], ['uid' => $users]); notice(L10n::tt('%s user unblocked', '%s users unblocked', count($users))); } @@ -139,7 +141,7 @@ class Users extends BaseAdminModule // @TODO: Replace with parameter from router $action = $a->argv[2]; $uid = $a->argv[3]; - $user = DBA::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]); + $user = User::getById($uid, ['username', 'blocked']); if (!DBA::isResult($user)) { notice('User not found' . EOL); $a->internalRedirect('admin/users'); @@ -160,11 +162,13 @@ class Users extends BaseAdminModule break; case 'block': parent::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't'); + // @TODO Move this to Model\User:block([$uid]); DBA::update('user', ['blocked' => 1], ['uid' => $uid]); notice(L10n::t('User "%s" blocked', $user['username'])); break; case 'unblock': parent::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't'); + // @TODO Move this to Model\User:unblock([$uid]); DBA::update('user', ['blocked' => 0], ['uid' => $uid]); notice(L10n::t('User "%s" unblocked', $user['username'])); break; @@ -178,7 +182,7 @@ class Users extends BaseAdminModule $pager = new Pager($a->query_string, 100); - /* ordering */ + // @TODO Move below block to Model\User::getUsers($start, $count, $order = 'contact.name', $order_direction = '+') $valid_orders = [ 'contact.name', 'user.email',