Skip to content

Commit

Permalink
ActivityManager can be initialized with null for the session variable…
Browse files Browse the repository at this point in the history
… in the ctor

This reverts commit 2cf02a0.
  • Loading branch information
DeepDiver1975 committed Jul 17, 2017
1 parent f7ee3b9 commit 6c61d4f
Show file tree
Hide file tree
Showing 2 changed files with 529 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/private/Activity/Manager.php
Expand Up @@ -59,7 +59,7 @@ class Manager implements IManager {
* @param IConfig $config
*/
public function __construct(IRequest $request,
IUserSession $session,
IUserSession $session = null,
IConfig $config) {
$this->request = $request;
$this->session = $session;
Expand Down Expand Up @@ -177,7 +177,7 @@ public function publish(IEvent $event) {
}

if ($event->getAuthor() === null) {
if ($this->session->getUser() instanceof IUser) {
if ($this->session !== null && $this->session->getUser() instanceof IUser) {
$event->setAuthor($this->session->getUser()->getUID());
}
}
Expand Down Expand Up @@ -501,7 +501,7 @@ public function setCurrentUserId($currentUserId) {
public function getCurrentUserId() {
if ($this->currentUserId !== null) {
return $this->currentUserId;
} else if (!$this->session->isLoggedIn()) {
} else if ($this->session === null || !$this->session->isLoggedIn()) {
return $this->getUserFromToken();
} else {
return $this->session->getUser()->getUID();
Expand Down

0 comments on commit 6c61d4f

Please sign in to comment.