summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-10-16 11:08:22 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-10-16 11:08:22 -0100
commit221ae0f1213fabcf8a3e67e65939b5556f83e32c (patch)
tree622040693889b89a062500dbd4ae648ed8eb6cc1
parent163fa57a3cd2d452dd9a91c1e8bae17c8f936897 (diff)
forward type of action
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--lib/Controller/OStatusController.php33
-rw-r--r--lib/Db/StreamRequest.php2
2 files changed, 31 insertions, 4 deletions
diff --git a/lib/Controller/OStatusController.php b/lib/Controller/OStatusController.php
index 10441966..633982a3 100644
--- a/lib/Controller/OStatusController.php
+++ b/lib/Controller/OStatusController.php
@@ -141,10 +141,10 @@ class OStatusController extends Controller {
}
try {
- $post = $this->streamService->getStreamById($uri, true, true);
+ $this->streamService->getStreamById($uri, true, true);
$link = $this->urlGenerator->linkToRouteAbsolute('social.SocialPub.displayRemotePost')
- . '?id=' . $uri;
+ . '?id=' . $uri . '&type=' . $this->parseRefererType();
return new RedirectResponse($link);
} catch (Exception $e) {
@@ -243,5 +243,34 @@ class OStatusController extends Controller {
}
}
+
+ /**
+ * @return string
+ */
+ private function parseRefererType(): string {
+ $referer = $this->request->getHeader('Referer');
+ $params = explode('&', parse_url($referer, PHP_URL_QUERY));
+ $type = '';
+ foreach ($params as $param) {
+ list($key, $value) = explode('=', $param);
+ if ($key === 'type') {
+ $type = $value;
+ }
+ }
+
+ switch ($type) {
+ case 'reblog':
+ return 'boost';
+
+ case 'favourite':
+ return 'like';
+
+ case 'reply':
+ return 'reply';
+ }
+
+ return '';
+ }
+
}
diff --git a/lib/Db/StreamRequest.php b/lib/Db/StreamRequest.php
index 9a2d9f0f..542c5614 100644
--- a/lib/Db/StreamRequest.php
+++ b/lib/Db/StreamRequest.php
@@ -241,8 +241,6 @@ class StreamRequest extends StreamRequestBuilder {
};
$qb = $this->getStreamSelectSql();
- $expr = $qb->expr();
-
$qb->limitToIdPrim($qb->prim($id));
$qb->linkToCacheActors('ca', 's.attributed_to_prim');