]> git.mxchange.org Git - friendica.git/commitdiff
Issue 11952: Avoid to send AP related comments to Diaspora
authorMichael <heluecht@pirati.ca>
Mon, 3 Oct 2022 10:40:16 +0000 (10:40 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 3 Oct 2022 10:40:16 +0000 (10:40 +0000)
src/Protocol/Diaspora.php
src/Worker/Notifier.php

index 9e80c130282428401353223353ec1cac6fd4c6d9..1bfe1ca652c8c9e6b654a1b8336eb7ff75ff4878 100644 (file)
@@ -4133,6 +4133,17 @@ class Diaspora
                        return false;
                }
 
+               $parent_post = Post::selectFirstPost(['gravity', 'signed_text', 'author-link'], ['uri-id' => $item['thr-parent-id']]);
+               if (empty(FContact::getByURL($parent_post['author-link'], false))) {
+                       Logger::info('Parent author is no Diaspora contact. A signature will not be created.', ['uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
+                       return false;
+               }
+
+               if (($parent_post['gravity'] == GRAVITY_COMMENT) && empty($parent_post['signed_text'])) {
+                       Logger::info('Parent comment has got no Diaspora signature. A signature will not be created.', ['uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
+                       return false;
+               }
+
                $message = self::constructComment($item, $owner);
                if ($message === false) {
                        return false;
index 3b4e1478c015527d45eac0aef9bdecf05094bfc0..7d3d3d6b7cc7033a1a8d06d18d78361d7e893c42 100644 (file)
@@ -191,6 +191,10 @@ class Notifier
                        // when the original comment author does support the Diaspora protocol.
                        if ($thr_parent['author-link'] && $target_item['parent-uri'] != $target_item['thr-parent']) {
                                $diaspora_delivery = Diaspora::isSupportedByContactUrl($thr_parent['author-link']);
+                               if ($diaspora_delivery &&  empty($target_item['signed_text'])) {
+                                       Logger::debug('Post has got no Diaspora signature, so there will be no Diaspora delivery', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id']]);
+                                       $diaspora_delivery = false;
+                               }
                                Logger::info('Threaded comment', ['diaspora_delivery' => (int)$diaspora_delivery]);
                        }