summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2023-06-14 00:34:07 -0100
committerMaxence Lange <maxence@artificial-owl.com>2023-06-14 00:34:07 -0100
commit23100a86b9f5e84cda147a7300744a4425709aa1 (patch)
tree90cae8db1aaae98dc1345556dcbbfb9dc938031f
parent2150774b9dad6c2e3db716a025358b7328004f7c (diff)
fix notification and update details on unreblog
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--lib/Interfaces/Object/AnnounceInterface.php42
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/Interfaces/Object/AnnounceInterface.php b/lib/Interfaces/Object/AnnounceInterface.php
index 1f18fe52..fb8a228e 100644
--- a/lib/Interfaces/Object/AnnounceInterface.php
+++ b/lib/Interfaces/Object/AnnounceInterface.php
@@ -136,7 +136,6 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
$activity->checkOrigin($announce->getId());
$activity->checkOrigin($announce->getActorId());
- $this->undoAnnounceAction($announce);
$this->delete($announce);
}
}
@@ -161,30 +160,20 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
*/
public function save(ACore $item): void {
/** @var Announce $item */
+ if ($item->hasActor()) {
+ $actor = $item->getActor();
+ } else {
+ $actor = $this->cacheActorService->getFromId($item->getActorId());
+ }
try {
$knownItem = $this->streamRequest->getStreamByObjectId($item->getObjectId(), Announce::TYPE);
- if ($item->hasActor()) {
- $actor = $item->getActor();
- } else {
- $actor = $this->cacheActorService->getFromId($item->getActorId());
- }
-
$knownItem->setAttributedTo($actor->getId());
if (!$knownItem->hasCc($actor->getFollowers())) {
$knownItem->addCc($actor->getFollowers());
$this->streamRequest->update($knownItem, true);
}
-
- try {
- $post = $this->streamRequest->getStreamById($item->getObjectId(), false, ACore::FORMAT_LOCAL);
- } catch (StreamNotFoundException $e) {
- return; // should not happen.
- }
-
- $this->updateDetails($post);
- $this->generateNotification($post, $actor);
} catch (StreamNotFoundException $e) {
$objectId = $item->getObjectId();
$item->addCacheItem($objectId);
@@ -195,6 +184,15 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
$item->getRequestToken(), StreamQueue::TYPE_CACHE, $item->getId()
);
}
+
+ try {
+ $post = $this->streamRequest->getStreamById($item->getObjectId(), false, ACore::FORMAT_LOCAL);
+ } catch (StreamNotFoundException $e) {
+ return; // should not happen.
+ }
+
+ $this->updateDetails($post);
+ $this->generateNotification($post, $actor);
}
@@ -230,6 +228,8 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
}
} catch (StreamNotFoundException|ItemUnknownException|SocialAppConfigException $e) {
}
+
+ $this->undoAnnounceAction($item);
}
public function event(ACore $item, string $source): void {
@@ -247,10 +247,10 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
}
//
- //
- //
- //
- //
+ //
+ //
+ //
+ //
// pourquoi update !????
// $to = $this->get('attributedTo', $cachedItem->getObject(), '');
@@ -279,7 +279,7 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
}
}
- private function undoAnnounceAction(Announce $announce): void {
+ private function undoAnnounceAction(ACore $announce): void {
try {
$this->actionsRequest->getActionFromItem($announce);
$this->actionsRequest->delete($announce);