mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-08 00:14:32 +02:00
Fix return type or UserSession::getUserIDForVisitorContactID()
This commit is contained in:
parent
7e66b35b46
commit
441846cfbd
3 changed files with 6 additions and 6 deletions
|
@ -101,7 +101,7 @@ class UserSession implements IHandleUserSessions
|
||||||
public function getUserIDForVisitorContactID(int $cid): int
|
public function getUserIDForVisitorContactID(int $cid): int
|
||||||
{
|
{
|
||||||
if (empty($this->session->get('remote'))) {
|
if (empty($this->session->get('remote'))) {
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_search($cid, $this->session->get('remote'));
|
return array_search($cid, $this->session->get('remote'));
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Post
|
||||||
$this->setTemplate('wall');
|
$this->setTemplate('wall');
|
||||||
$this->toplevel = $this->getId() == $this->getDataValue('parent');
|
$this->toplevel = $this->getId() == $this->getDataValue('parent');
|
||||||
|
|
||||||
if (!empty(DI::userSession()->getUserIDForVisitorContactID($this->getDataValue('contact-id')))) {
|
if (DI::userSession()->getUserIDForVisitorContactID($this->getDataValue('contact-id')) !== 0) {
|
||||||
$this->visiting = true;
|
$this->visiting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,13 +152,13 @@ class UserSessionTest extends MockedTestCase
|
||||||
'data' => [
|
'data' => [
|
||||||
'remote' => ['3' => '21'],
|
'remote' => ['3' => '21'],
|
||||||
],
|
],
|
||||||
'expected' => false,
|
'expected' => 0,
|
||||||
],
|
],
|
||||||
'empty' => [
|
'empty' => [
|
||||||
'cid' => 21,
|
'cid' => 21,
|
||||||
'data' => [
|
'data' => [
|
||||||
],
|
],
|
||||||
'expected' => false,
|
'expected' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ class UserSessionTest extends MockedTestCase
|
||||||
public function testGetUserIdForVisitorContactID(int $cid, array $data, $expected)
|
public function testGetUserIdForVisitorContactID(int $cid, array $data, $expected)
|
||||||
{
|
{
|
||||||
$userSession = new UserSession(new ArraySession($data));
|
$userSession = new UserSession(new ArraySession($data));
|
||||||
$this->assertEquals($expected, $userSession->getUserIDForVisitorContactID($cid));
|
$this->assertSame($expected, $userSession->getUserIDForVisitorContactID($cid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataAuthenticated()
|
public function dataAuthenticated()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue