mirror of
https://github.com/friendica/friendica
synced 2025-04-30 03:04:23 +02:00
UserSession class [5] - Refactor src/Module/ files with DI
This commit is contained in:
parent
a729f3255d
commit
eecc456e0c
78 changed files with 455 additions and 530 deletions
|
@ -25,7 +25,6 @@ use Friendica\App;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Response;
|
||||
|
@ -51,10 +50,10 @@ class Saved extends BaseModule
|
|||
|
||||
$return_url = $_GET['return_url'] ?? Search::getSearchPath($search);
|
||||
|
||||
if (Session::getLocalUser() && $search) {
|
||||
if (DI::userSession()->getLocalUserId() && $search) {
|
||||
switch ($action) {
|
||||
case 'add':
|
||||
$fields = ['uid' => Session::getLocalUser(), 'term' => $search];
|
||||
$fields = ['uid' => DI::userSession()->getLocalUserId(), 'term' => $search];
|
||||
if (!$this->dba->exists('search', $fields)) {
|
||||
if (!$this->dba->insert('search', $fields)) {
|
||||
DI::sysmsg()->addNotice($this->t('Search term was not saved.'));
|
||||
|
@ -65,7 +64,7 @@ class Saved extends BaseModule
|
|||
break;
|
||||
|
||||
case 'remove':
|
||||
if (!$this->dba->delete('search', ['uid' => Session::getLocalUser(), 'term' => $search])) {
|
||||
if (!$this->dba->delete('search', ['uid' => DI::userSession()->getLocalUserId(), 'term' => $search])) {
|
||||
DI::sysmsg()->addNotice($this->t('Search term was not removed.'));
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue