From b99e7a9e928942961305b4e8bed7a87af50091c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Wagner?= Date: Fri, 28 Oct 2022 18:51:35 +0200 Subject: [PATCH 1/5] fix exception when adding an poll option without votes --- src/Model/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index c09b2754df..143b719bd3 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3402,7 +3402,7 @@ class Item $percent = $option['replies'] / $question['voters'] * 100; $options[$key]['vote'] = DI::l10n()->tt('%2$s (%3$d%%, %1$d vote)', '%2$s (%3$d%%, %1$d votes)', $option['replies'], $option['name'], round($percent, 1)); } else { - $options[$key]['vote'] = DI::l10n()->tt('%2$s (%1$d vote)', '%2$s (%1$d votes)', $option['replies'], $option['name'], ); + $options[$key]['vote'] = DI::l10n()->tt('%2$s (%1$d vote)', '%2$s (%1$d votes)', $option['replies'], $option['name'], 0); } } From a2adb1cd9315df439ece0bcb72076e91e9734050 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 28 Oct 2022 13:45:09 -0400 Subject: [PATCH 2/5] Remove unused argument from L10n->tt() call in Model/Item.php --- src/Model/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 143b719bd3..db2eecdf6b 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3402,7 +3402,7 @@ class Item $percent = $option['replies'] / $question['voters'] * 100; $options[$key]['vote'] = DI::l10n()->tt('%2$s (%3$d%%, %1$d vote)', '%2$s (%3$d%%, %1$d votes)', $option['replies'], $option['name'], round($percent, 1)); } else { - $options[$key]['vote'] = DI::l10n()->tt('%2$s (%1$d vote)', '%2$s (%1$d votes)', $option['replies'], $option['name'], 0); + $options[$key]['vote'] = DI::l10n()->tt('%2$s (%1$d vote)', '%2$s (%1$d votes)', $option['replies'], $option['name']); } } From fed17d031c06dec6c16ead598d46507512af83f8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 28 Oct 2022 21:13:45 -0400 Subject: [PATCH 3/5] [Composer] Remove bower-asset/vue dependency - The Bower package doesn't have the dist/vue.min.js anymore (?) which is required for the advancedcontentfilter addon --- composer.json | 1 - composer.lock | 18 +----------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/composer.json b/composer.json index 43cb7a3fd0..34c0f62582 100644 --- a/composer.json +++ b/composer.json @@ -59,7 +59,6 @@ "bower-asset/chart-js": "^2.8", "bower-asset/dompurify": "^1.0", "bower-asset/fork-awesome": "^1.1", - "bower-asset/vue": "^2.6", "npm-asset/cropperjs": "1.2.2", "npm-asset/es-jquery-sortable": "^0.9.13", "npm-asset/fullcalendar": "^3.10", diff --git a/composer.lock b/composer.lock index 96949561bb..786880fab8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c851fbba46ed090d0fbaf68e9b3b94df", + "content-hash": "e8626dc6957dff9cc783daad10cfc26f", "packages": [ { "name": "asika/simple-console", @@ -241,22 +241,6 @@ ], "time": "2021-08-26T18:46:39+00:00" }, - { - "name": "bower-asset/vue", - "version": "v2.7.10", - "source": { - "type": "git", - "url": "https://github.com/vuejs/vue.git", - "reference": "ee57d9fd1d51abe245c6c37e6f8f2d45977b929e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vuejs/vue/zipball/ee57d9fd1d51abe245c6c37e6f8f2d45977b929e", - "reference": "ee57d9fd1d51abe245c6c37e6f8f2d45977b929e", - "shasum": "" - }, - "type": "bower-asset-library" - }, { "name": "brick/math", "version": "0.9.3", From f44c9e7975db6ee7504db36cb5baaecd82366f8a Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 29 Oct 2022 19:04:29 +0000 Subject: [PATCH 4/5] Accepting contact request does finally work per Mastodon API --- src/Factory/Api/Mastodon/Notification.php | 5 ++++- src/Module/Api/Mastodon/FollowRequests.php | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Factory/Api/Mastodon/Notification.php b/src/Factory/Api/Mastodon/Notification.php index 33c252e4f1..3e43835b43 100644 --- a/src/Factory/Api/Mastodon/Notification.php +++ b/src/Factory/Api/Mastodon/Notification.php @@ -83,7 +83,10 @@ class Notification extends BaseFactory public static function getType(Entity\Notification $Notification): string { if (($Notification->verb == Activity::FOLLOW) && ($Notification->type === Post\UserNotification::TYPE_NONE)) { - $contact = Contact::getById($Notification->actorId, ['pending']); + $contact = Contact::getById($Notification->actorId, ['pending', 'uri-id', 'uid']); + if (($contact['uid'] == 0) && !empty($contact['uri-id'])) { + $contact = Contact::selectFirst(['pending', 'uri-id', 'uid'], ['uri-id' => $contact['uri-id'], 'uid' => $Notification->uid]); + } $type = $contact['pending'] ? MstdnNotification::TYPE_INTRODUCTION : MstdnNotification::TYPE_FOLLOW; } elseif (($Notification->verb == Activity::ANNOUNCE) && in_array($Notification->type, [Post\UserNotification::TYPE_DIRECT_COMMENT, Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT])) { diff --git a/src/Module/Api/Mastodon/FollowRequests.php b/src/Module/Api/Mastodon/FollowRequests.php index 99e20cd7f0..af08517e97 100644 --- a/src/Module/Api/Mastodon/FollowRequests.php +++ b/src/Module/Api/Mastodon/FollowRequests.php @@ -47,7 +47,12 @@ class FollowRequests extends BaseApi self::checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); - $introduction = DI::intro()->selectOneById($this->parameters['id'], $uid); + $cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid); + if (empty($cdata['user'])) { + throw new HTTPException\NotFoundException('Contact not found'); + } + + $introduction = DI::intro()->selectForContact($cdata['user']); $contactId = $introduction->cid; From 8bba8663fbfca8ee3f0ca125d1022ef4df682082 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 29 Oct 2022 19:11:26 +0000 Subject: [PATCH 5/5] Only fetch the needed field --- src/Factory/Api/Mastodon/Notification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Factory/Api/Mastodon/Notification.php b/src/Factory/Api/Mastodon/Notification.php index 3e43835b43..adaf2d8689 100644 --- a/src/Factory/Api/Mastodon/Notification.php +++ b/src/Factory/Api/Mastodon/Notification.php @@ -85,7 +85,7 @@ class Notification extends BaseFactory if (($Notification->verb == Activity::FOLLOW) && ($Notification->type === Post\UserNotification::TYPE_NONE)) { $contact = Contact::getById($Notification->actorId, ['pending', 'uri-id', 'uid']); if (($contact['uid'] == 0) && !empty($contact['uri-id'])) { - $contact = Contact::selectFirst(['pending', 'uri-id', 'uid'], ['uri-id' => $contact['uri-id'], 'uid' => $Notification->uid]); + $contact = Contact::selectFirst(['pending'], ['uri-id' => $contact['uri-id'], 'uid' => $Notification->uid]); } $type = $contact['pending'] ? MstdnNotification::TYPE_INTRODUCTION : MstdnNotification::TYPE_FOLLOW; } elseif (($Notification->verb == Activity::ANNOUNCE) &&