summaryrefslogtreecommitdiffstats
path: root/lib/Controller/LocalController.php
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-11-30 20:31:32 -0100
committerJulius Härtl <jus@bitgrid.net>2018-12-03 07:14:39 +0100
commitf9f2b07d7ea36db8e4e6c8403ed3378a5b60d48f (patch)
treec0a2182b460bb60bf9e4120142bc2bb82b9cd49d /lib/Controller/LocalController.php
parent3eafb16c4ed742bbae5da4e5a585e16c2f05638a (diff)
Followers/Following
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Controller/LocalController.php')
-rw-r--r--lib/Controller/LocalController.php77
1 files changed, 77 insertions, 0 deletions
diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php
index 03dba180..cc37a5eb 100644
--- a/lib/Controller/LocalController.php
+++ b/lib/Controller/LocalController.php
@@ -375,6 +375,82 @@ class LocalController extends Controller {
/**
+ * @NoCSRFRequired
+ * @NoAdminRequired
+ * @NoSubAdminRequired
+ *
+ * @return DataResponse
+ */
+ public function currentFollowers(): DataResponse {
+ try {
+ $actor = $this->actorService->getActorFromUserId($this->userId);
+ $followers = $this->followService->getFollowers($actor);
+
+ return $this->success($followers);
+ } catch (Exception $e) {
+ return $this->fail($e);
+ }
+ }
+
+
+ /**
+ * @NoCSRFRequired
+ * @NoAdminRequired
+ * @NoSubAdminRequired
+ *
+ * @return DataResponse
+ */
+ public function currentFollowing(): DataResponse {
+ try {
+ $actor = $this->actorService->getActorFromUserId($this->userId);
+ $followers = $this->followService->getFollowing($actor);
+
+ return $this->success($followers);
+ } catch (Exception $e) {
+ return $this->fail($e);
+ }
+ }
+
+
+ /**
+ * @NoCSRFRequired
+ * @NoAdminRequired
+ * @NoSubAdminRequired
+ *
+ * @return DataResponse
+ */
+ public function accountFollowers(string $username): DataResponse {
+ try {
+ $actor = $this->actorService->getActor($username);
+ $followers = $this->followService->getFollowers($actor);
+
+ return $this->success($followers);
+ } catch (Exception $e) {
+ return $this->fail($e);
+ }
+ }
+
+
+ /**
+ * @NoCSRFRequired
+ * @NoAdminRequired
+ * @NoSubAdminRequired
+ *
+ * @return DataResponse
+ */
+ public function accountFollowing(string $username): DataResponse {
+ try {
+ $actor = $this->actorService->getActor($username);
+ $followers = $this->followService->getFollowing($actor);
+
+ return $this->success($followers);
+ } catch (Exception $e) {
+ return $this->fail($e);
+ }
+ }
+
+
+ /**
*
* // TODO: Delete the NoCSRF check
*
@@ -425,6 +501,7 @@ class LocalController extends Controller {
* @NoSubAdminRequired
*
* @param string $id
+ *
* @return DataResponse
*/
public function actorAvatar(string $id): Response {