Commit 1f2b0f83 authored by Thomas Löffler's avatar Thomas Löffler

Merge branch 'bugfix/viewhelpers' into 'develop'

[Bugfix] update viewhelpers for version 9

See merge request !160
parents 3c3f2a94 86e00ce7
Pipeline #7094 passed with stages
in 2 minutes and 40 seconds
......@@ -16,6 +16,10 @@
"type": "vcs",
"url": "https://git-t3o.typo3.org/t3o/t3olayout.git"
},
{
"type": "vcs",
"url": "https://github.com/in2code-de/userprofile.git"
},
{
"type": "vcs",
"url": "https://git-t3o.typo3.org/t3o/gitlab_api.git"
......@@ -36,7 +40,7 @@
"t3o/t3omy": "@dev",
"t3o/t3o_slack": "@dev",
"t3o/t3o_ldap": "@dev",
"in2code/userprofile": "^0.3"
"in2code/userprofile": "dev-singleview"
},
"config": {
"platform": {
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ff185ffb5293f017715ba156a6a3cdca",
"content-hash": "1dfa7a882d3c640d8b72fc8fe114535b",
"packages": [
{
"name": "adoy/fastcgi-client",
......@@ -1282,7 +1282,7 @@
},
{
"name": "in2code/userprofile",
"version": "0.3.0",
"version": "dev-singleview",
"source": {
"type": "git",
"url": "https://github.com/in2code-de/userprofile.git",
......@@ -1303,16 +1303,19 @@
"In2code\\Userprofile\\": "Classes"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0+"
],
"description": "TYPO3-Extension to manage user profiles",
"homepage": "https://www.in2code.de",
"keywords": [
"extension",
"typo3"
"TYPO3",
"extension"
],
"support": {
"source": "https://github.com/in2code-de/userprofile/tree/0.3.0",
"issues": "https://github.com/in2code-de/userprofile/issues"
},
"time": "2019-05-21T12:16:07+00:00"
},
{
......@@ -4890,7 +4893,8 @@
"t3o/t3olayout": 20,
"t3o/t3omy": 20,
"t3o/t3o_slack": 20,
"t3o/t3o_ldap": 20
"t3o/t3o_ldap": 20,
"in2code/userprofile": 20
},
"prefer-stable": false,
"prefer-lowest": false,
......
......@@ -22,12 +22,11 @@ class ShowSlackLinkViewHelper extends AbstractViewHelper
/**
* Check if a property of the userprofile is visible in the current context
*
* @param int $frontendUserUID
* @return string
*/
public function render(int $frontendUserUID)
public function render()
{
$feUser = $this->slackFrontendUserRepository->findByUid($frontendUserUID);
$feUser = $this->slackFrontendUserRepository->findByUid((int)$this->arguments['frontendUserUID']);
$slackUser = $this->slackUserRepository->findBySlackId($feUser->getSlackId());
if ($slackUser) {
......@@ -38,7 +37,7 @@ class ShowSlackLinkViewHelper extends AbstractViewHelper
}
} else {
// @todo render link to register for slack
if ($GLOBALS['TSFE']->fe_user->user['uid'] == $frontendUserUID) {
if ($GLOBALS['TSFE']->fe_user->user['uid'] === (int)$this->arguments['frontendUserUID']) {
// @todo add TS configuration
$content = '<a href="https://my.typo3.org/?id=23">Get your TYPO3 Slack Account</a>';
} else {
......@@ -48,4 +47,13 @@ class ShowSlackLinkViewHelper extends AbstractViewHelper
return $content;
}
/**
* Initialize
*/
public function initializeArguments()
{
parent::initializeArguments();
$this->registerArgument('frontendUserUID', 'integer', 'UID of the FrontendUser which should get displayed');
}
}
......@@ -25,12 +25,11 @@ class IsSlackOnlineViewhelper extends AbstractViewHelper
/**
* Checks if the user is online in slack
*
* @param int $frontendUserUID
* @return string
*/
public function render($frontendUserUID)
public function render()
{
$feUser = $this->slackFrontendUserRepository->findByUid($frontendUserUID);
$feUser = $this->slackFrontendUserRepository->findByUid((int)$this->arguments['frontendUserUID']);
$slackUser = $this->slackUserRepository->findBySlackId($feUser->getSlackId());
if ($slackUser) {
......@@ -45,4 +44,13 @@ class IsSlackOnlineViewhelper extends AbstractViewHelper
}
return $status;
}
/**
* Initialize
*/
public function initializeArguments()
{
parent::initializeArguments();
$this->registerArgument('frontendUserUID', 'integer', 'UID of the FrontendUser which should get displayed');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment