From bb31bbdca2acb7e03f56f12bbdb34a549db88988 Mon Sep 17 00:00:00 2001 From: leiyong <1549684884@qq.com> Date: Tue, 7 Jun 2022 07:55:58 +0000 Subject: [PATCH] * Finish task#56360. --- module/bug/model.php | 2 ++ module/user/model.php | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/module/bug/model.php b/module/bug/model.php index de5edeb1bf..64c6001068 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1868,6 +1868,8 @@ class bugModel extends model if(!empty($this->config->isINT)) $firstLetter = ''; $users[$account] = $firstLetter . ($user->realname ? $user->realname : $user->account); } + + $users = $this->loadModel('user')->processAccountSort($users); return array('' => '') + $users; } diff --git a/module/user/model.php b/module/user/model.php index 52cc9b3269..f07db87f87 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -136,6 +136,9 @@ class userModel extends model } } + // Put the current user first. + $users = $this->processAccountSort($users); + /* Append empty, closed, and guest users. */ if(strpos($params, 'noempty') === false) $users = array('' => '') + $users; if(strpos($params, 'noclosed') === false) $users = $users + array('closed' => 'Closed'); @@ -2623,6 +2626,10 @@ class userModel extends model if(!empty($this->config->isINT)) $firstLetter = ''; $users[$account] = $firstLetter . ($user->realname ? $user->realname : $user->account); } + + // Put the current user first. + $users = $this->processAccountSort($users); + return array('' => '') + $users; } @@ -2828,4 +2835,23 @@ class userModel extends model $admins = explode(',', trim($company->admins, ',')); $this->app->user = $this->dao->select('*')->from(TABLE_USER)->where('account')->eq($admins[0])->fetch(); } + + /** + * Put the current user first. + * + * @param array $users + * @access public + * @return array + */ + public function processAccountSort($users = array()) + { + if(isset($users[$this->app->user->account])) + { + $currentUser = array(); + $currentUser[$this->app->user->account] = $users[$this->app->user->account]; + unset($users[$this->app->user->account]); + $users = $currentUser + $users; + } + return $users; + } }