From 9f388e59cf6136b2a4dba41d46617dfb97192a96 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Mon, 19 Nov 2018 09:32:52 -0100 Subject: [PATCH] accepted field in db Signed-off-by: Maxence Lange --- appinfo/database.xml | 7 +++++++ appinfo/info.xml | 2 +- lib/Db/FollowsRequest.php | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/appinfo/database.xml b/appinfo/database.xml index f7b137cc..0c311e43 100644 --- a/appinfo/database.xml +++ b/appinfo/database.xml @@ -91,6 +91,13 @@ true + + accepted + boolean + false + true + + creation timestamp diff --git a/appinfo/info.xml b/appinfo/info.xml index 3ff28c34..4627747d 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,7 +5,7 @@ Social 🎉 Nextcloud becomes part of the federated social networks! - 0.0.33 + 0.0.34 agpl Maxence Lange Julius Härtl diff --git a/lib/Db/FollowsRequest.php b/lib/Db/FollowsRequest.php index 6dd84ac1..66058064 100644 --- a/lib/Db/FollowsRequest.php +++ b/lib/Db/FollowsRequest.php @@ -31,7 +31,6 @@ declare(strict_types=1); namespace OCA\Social\Db; -use Exception; use OCA\Social\Exceptions\FollowDoesNotExistException; use OCA\Social\Model\ActivityPub\Follow; use OCA\Social\Model\ActivityPub\Person; @@ -60,6 +59,20 @@ class FollowsRequest extends FollowsRequestBuilder { } + /** + * @param Follow $follow + */ + public function accepted(Follow $follow) { + $qb = $this->getFollowsUpdateSql(); + $qb->set('accepted', $qb->createNamedParameter('1')); + $this->limitToIdString($qb, $follow->getId()); + $this->limitToActorId($qb, $follow->getActorId()); + $this->limitToObjectId($qb, $follow->getObjectId()); + + $qb->execute(); + } + + /** * @param Person $actor * @param Person $remote