diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-10-11 11:18:16 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2019-10-14 10:47:07 -0100 |
commit | 79d7cdf350fe0af40b94e50a9c55dc50561508e3 (patch) | |
tree | c0190208fa5a58bab9e2afe99bf824a1efa12313 | |
parent | 9e7a22348bbcccb6c50c247304c284dcbd9d31a5 (diff) |
redirect to displayRemotePost
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r-- | lib/Controller/OStatusController.php | 22 | ||||
-rw-r--r-- | lib/Controller/SocialPubController.php | 2 | ||||
-rw-r--r-- | lib/webfinger.php | 2 |
3 files changed, 18 insertions, 8 deletions
diff --git a/lib/Controller/OStatusController.php b/lib/Controller/OStatusController.php index 8af7604f..10441966 100644 --- a/lib/Controller/OStatusController.php +++ b/lib/Controller/OStatusController.php @@ -43,9 +43,11 @@ use OCA\Social\Service\CurlService; use OCA\Social\Service\MiscService; use OCA\Social\Service\StreamService; use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\TemplateResponse; use OCP\IRequest; +use OCP\IURLGenerator; use OCP\IUserManager; use OCP\IUserSession; @@ -60,6 +62,9 @@ class OStatusController extends Controller { /** @var IUserManager */ private $userSession; + /** @var IURLGenerator */ + private $urlGenerator; + /** @var CacheActorService */ private $cacheActorService; @@ -79,27 +84,29 @@ class OStatusController extends Controller { /** * OStatusController constructor. * + * @param IUserSession $userSession * @param IRequest $request + * @param IURLGenerator $urlGenerator * @param StreamService $streamService * @param CacheActorService $cacheActorService * @param AccountService $accountService * @param CurlService $curlService * @param MiscService $miscService - * @param IUserSession $userSession */ public function __construct( - IUserSession $userSession, IRequest $request, StreamService $streamService, - CacheActorService $cacheActorService, AccountService $accountService, CurlService $curlService, - MiscService $miscService + IUserSession $userSession, IRequest $request, IURLGenerator $urlGenerator, + StreamService $streamService, CacheActorService $cacheActorService, AccountService $accountService, + CurlService $curlService, MiscService $miscService ) { parent::__construct(Application::APP_NAME, $request); + $this->userSession = $userSession; + $this->urlGenerator = $urlGenerator; $this->cacheActorService = $cacheActorService; $this->streamService = $streamService; $this->accountService = $accountService; $this->curlService = $curlService; $this->miscService = $miscService; - $this->userSession = $userSession; } @@ -136,7 +143,10 @@ class OStatusController extends Controller { try { $post = $this->streamService->getStreamById($uri, true, true); - return $this->directSuccess($post); + $link = $this->urlGenerator->linkToRouteAbsolute('social.SocialPub.displayRemotePost') + . '?id=' . $uri; + + return new RedirectResponse($link); } catch (Exception $e) { } diff --git a/lib/Controller/SocialPubController.php b/lib/Controller/SocialPubController.php index c6813c2d..5e67913b 100644 --- a/lib/Controller/SocialPubController.php +++ b/lib/Controller/SocialPubController.php @@ -282,7 +282,7 @@ class SocialPubController extends Controller { ]; $this->miscService->log('----- ' . json_encode($data)); - + return new TemplateResponse(Application::APP_NAME, 'stream', $data); } diff --git a/lib/webfinger.php b/lib/webfinger.php index abafdeba..cb6888e7 100644 --- a/lib/webfinger.php +++ b/lib/webfinger.php @@ -128,7 +128,7 @@ $finger = [ ], [ 'rel' => 'http://ostatus.org/schema/1.0/subscribe', - 'template' => urldecode($href = $urlGenerator->linkToRouteAbsolute('social.OStatus.subscribe')) + 'template' => urldecode($urlGenerator->linkToRouteAbsolute('social.OStatus.subscribe')) . '?uri={uri}' ] ] |