summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2023-03-21 10:25:11 -0100
committerMaxence Lange <maxence@artificial-owl.com>2023-03-21 10:25:11 -0100
commitbcb91ac143ee8517eff07f2351c9cc63f1643d25 (patch)
tree1b74a81255f34e71d9c19dbb123167fbbba898ff
parent3f3edc4fd6e958505f67dd6f03424fa8fe5d13b4 (diff)
fix unreblog
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--lib/Model/ActivityPub/Stream.php2
-rw-r--r--lib/Service/ActionService.php7
-rw-r--r--lib/Service/BoostService.php6
3 files changed, 9 insertions, 6 deletions
diff --git a/lib/Model/ActivityPub/Stream.php b/lib/Model/ActivityPub/Stream.php
index 312ad91b..274ae0b9 100644
--- a/lib/Model/ActivityPub/Stream.php
+++ b/lib/Model/ActivityPub/Stream.php
@@ -630,7 +630,7 @@ class Stream extends ACore implements IQueryRow, JsonSerializable {
"content" => $this->getContent(),
"sensitive" => $this->isSensitive(),
"spoiler_text" => $this->getSpoilerText(),
- 'visibility' => ($this->getVisibility() === '') ? 'unknown' : $this->getVisibility(),
+ 'visibility' => $this->getVisibility(),
"language" => $this->getLanguage(),
"in_reply_to_id" => null,
"in_reply_to_account_id" => null,
diff --git a/lib/Service/ActionService.php b/lib/Service/ActionService.php
index 704c59d4..b318c795 100644
--- a/lib/Service/ActionService.php
+++ b/lib/Service/ActionService.php
@@ -139,7 +139,10 @@ class ActionService {
}
private function reblog(Person $actor, string $postId, bool $enabled = true): void {
- $this->boostService->create($actor, $postId);
- //$this->streamActionService->setActionBool($actor->getId(), $postId, StreamAction::BOOSTED, $enabled);
+ if ($enabled) {
+ $this->boostService->create($actor, $postId);
+ } else {
+ $this->boostService->delete($actor, $postId);
+ }
}
}
diff --git a/lib/Service/BoostService.php b/lib/Service/BoostService.php
index f34d68e7..668d5393 100644
--- a/lib/Service/BoostService.php
+++ b/lib/Service/BoostService.php
@@ -105,7 +105,7 @@ class BoostService {
* @throws SocialAppConfigException
* @throws Exception
*/
- public function create(Person $actor, string $postId, &$token = ''): ACore {
+ public function create(Person $actor, string $postId, string &$token = ''): ACore {
/** @var Announce $announce */
$announce = AP::$activityPub->getItemFromType(Announce::TYPE);
$this->streamService->assignItem($announce, $actor, Stream::TYPE_ANNOUNCE);
@@ -169,7 +169,7 @@ class BoostService {
* @throws SocialAppConfigException
* @throws StreamNotFoundException
*/
- public function delete(Person $actor, string $postId, &$token = ''): ACore {
+ public function delete(Person $actor, string $postId, string &$token = ''): ACore {
$undo = new Undo();
$this->streamService->assignItem($undo, $actor, Stream::TYPE_PUBLIC);
$undo->setActor($actor);
@@ -188,7 +188,7 @@ class BoostService {
$interface = AP::$activityPub->getInterfaceFromType(Announce::TYPE);
$interface->delete($announce);
-// $this->streamRequest->deleteStreamById($announce->getId(), Announce::TYPE);
+ $this->streamRequest->deleteById($announce->getId(), Announce::TYPE);
$this->signatureService->signObject($actor, $undo);
$token = $this->activityService->request($undo);