FriendsOfFlarum / gamification

Add upvotes, downvotes, and ranks to your Flarum Community
https://discuss.flarum.org/d/20671-friendsofflarum-gamification
MIT License
36 stars 17 forks source link

BadMethodCallException on some tags #111

Closed AruMoon closed 11 months ago

AruMoon commented 1 year ago

Bug Report

Current Behavior Some tag discussion lists can't be opened after a recent update.

Steps to Reproduce

  1. Go to tag discussion list

Expected Behavior See discussion list

Screenshots Screenshot_20231116_155244

Environment

Flarum core: 1.8.3
PHP version: 8.2.7
MySQL version: 8.0.35
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, bcmath, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, intl, exif, mysqli, pdo_mysql, pdo_pgsql, pgsql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache
+---------------------------------------+----------+--------+
| Flarum Extensions                     |          |        |
+---------------------------------------+----------+--------+
| ID                                    | Version  | Commit |
+---------------------------------------+----------+--------+
| flarum-tags                           | v1.8.0   |        |
| flarum-markdown                       | v1.8.0   |        |
| flarum-suspend                        | v1.8.1   |        |
| flarum-mentions                       | v1.8.2   |        |
| flarum-subscriptions                  | v1.8.0   |        |
| flarum-flags                          | v1.8.0   |        |
| askvortsov-rich-text                  | v2.1.7   |        |
| flarum-sticky                         | v1.8.0   |        |
| flarum-lock                           | v1.8.0   |        |
| fof-formatting                        | 1.0.3    |        |
| fof-user-directory                    | 1.3.3    |        |
| fof-follow-tags                       | 1.2.2    |        |
| fof-impersonate                       | 1.1.1    |        |
| fof-byobu                             | 1.3.4    |        |
| v17development-blog                   | v0.7.7   |        |
| fof-merge-discussions                 | 1.4.1    |        |
| fof-oauth                             | 1.6.1    |        |
| afrux-forum-widgets-core              | v0.1.7   |        |
| ziiven-view-history                   | v0.1.7   |        |
| yannisme-confixtheme                  | 2.3.6    |        |
| v17development-third-party-login-only | v0.1.1   |        |
| therealsujitk-gifs                    | v4.1.1   |        |
| the-turk-miserable-users              | 1.0.2    |        |
| the-turk-flamoji                      | 1.0.4    |        |
| the-turk-diff                         | 1.1.2    |        |
| sycho-profile-cover                   | v1.3.5   |        |
| sycho-lite-youtube                    | v0.1.1   |        |
| sycho-advanced-extension-categories   | v0.1.3   |        |
| rob006-last-post-avatar               | 1.2.4    |        |
| noriods-auto-more                     | v1.0.0   |        |
| nearata-sensitive-content             | 1.1.0    |        |
| nearata-maintenance-mode              | 1.0.0    |        |
| nearata-internal-links-noreload       | v2.2.0   |        |
| nearata-gif-avatars                   | 1.0.0    |        |
| nearata-embed-twitch                  | v2.0.1   |        |
| nearata-copy-code-to-clipboard        | v2.2.0   |        |
| michaelbelgium-profile-views          | v8.0.2   |        |
| michaelbelgium-discussion-views       | v7.2.1   |        |
| matteociaroni-public-suspensions      | v1.0.0   |        |
| kilowhat-audit-free                   | 1.7.0    |        |
| katosdev-signature                    | 1.3      |        |
| justoverclock-hashtag                 | 1.0.1    |        |
| imshuzai-right-and-center-bbcode      | 1.0.0    |        |
| ianm-syndication                      | 1.3.3    |        |
| ianm-log-viewer                       | 0.1.1    |        |
| ianm-follow-users                     | 1.4.2    |        |
| fof-webhooks                          | 1.2.3    |        |
| fof-username-request                  | 1.2.2    |        |
| fof-user-bio                          | 1.3.1    |        |
| fof-upload                            | 1.4.7    |        |
| fof-subscribed                        | 1.1.4    |        |
| fof-split                             | 1.1.1    |        |
| fof-spamblock                         | 1.1.2    |        |
| fof-socialprofile                     | 1.1.6    |        |
| fof-share-social                      | 1.1.3    |        |
| fof-secure-https                      | 1.1.3    |        |
| fof-reactions                         | 1.3.2    |        |
| fof-profile-image-crop                | 1.1.6    |        |
| fof-polls                             | 2.1.2    |        |
| fof-pages                             | 1.0.8    |        |
| fof-nightmode                         | 1.5.3    |        |
| fof-moderator-notes                   | 1.2.1    |        |
| fof-links                             | 1.2.1    |        |
| fof-linguist                          | 1.1.2    |        |
| fof-ignore-users                      | 1.2.1    |        |
| fof-github-autolink                   | 1.1.4    |        |
| fof-geoip                             | 1.3.0    |        |
| fof-gamification                      | 1.6.4    |        |
| fof-default-user-preferences          | 1.2.1    |        |
| fof-analytics                         | 1.1.0    |        |
| flarumtr-mobile-search                | v1.2     |        |
| flarum-statistics                     | v1.8.0   |        |
| flarum-pusher                         | v1.8.0   |        |
| flarum-lang-ukrainian                 | v1.30.0  |        |
| flarum-lang-russian                   | 1.23.0   |        |
| flarum-lang-english                   | v1.8.0   |        |
| flarum-bbcode                         | v1.8.0   |        |
| datlechin-offline-indicator           | v0.1.0   |        |
| datlechin-link-preview                | v1.4.0   |        |
| darkle-fancybox                       | 1.1.2    |        |
| clarkwinkelmann-shadow-ban            | 1.1.0    |        |
| clarkwinkelmann-predefined-avatars    | 1.0.1    |        |
| clarkwinkelmann-group-list            | 1.0.0    |        |
| clarkwinkelmann-circle-groups         | 1.0.1    |        |
| clamours-sticky-sidenav-blog          | v0.1.1   |        |
| blomstra-horizon                      | 0.3.4    |        |
| blomstra-flag-duplicates              | 0.2.1    |        |
| betterflarum-bettermobiledrawer       | 2.2.0    |        |
| askvortsov-pwa                        | v3.3.3   |        |
| askvortsov-moderator-warnings         | v0.6.3   |        |
| askvortsov-help-tags                  | v1.1.0   |        |
| askvortsov-discussion-templates       | v0.8.3   |        |
| arumoon-oauth-ss14                    | dev-main |        |
| arumoon-age-check                     | dev-main |        |
| afrux-news-widget                     | v0.1.1   |        |
| acpl-mobile-tab                       | 1.4.1    |        |
+---------------------------------------+----------+--------+
Base URL: https://forum.starshine.club
Installation path: /var/www/ss14-forum
Queue driver: redis
Session driver: redis (Code override. Configured to file)
Scheduler status: core.admin.dashboard.status.scheduler.active
Mail driver: smtp
Debug mode: off

Possible solution(s)

Additional Context Here is the error log on the server

[2023-11-16 10:47:14] flarum.ERROR: BadMethodCallException: Method Illuminate\Support\Collection::loadSum does not exist. in /var/www/ss14-forum/vendor/illuminate/macroable/Traits/Macroable.php:113
Stack trace:
#0 /var/www/ss14-forum/vendor/fof/gamification/src/LoadActorVoteRelationship.php(50): Illuminate\Support\Collection->__call()
#1 /var/www/ss14-forum/vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php(121): FoF\Gamification\LoadActorVoteRelationship::sumRelation()
#2 /var/www/ss14-forum/vendor/flarum/core/src/Http/RouteHandlerFactory.php(41): Flarum\Api\Controller\AbstractSerializeController->handle()
#3 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->Flarum\Http\{closure}()
#4 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ExecuteRoute->process()
#5 /var/www/ss14-forum/vendor/fof/reactions/src/Middleware/BindRequestToContainer.php(35): Laminas\Stratigility\Next->handle()
#6 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): FoF\Reactions\Middleware\BindRequestToContainer->process()
#7 /var/www/ss14-forum/vendor/kilowhat/flarum-ext-audit-free/src/Middlewares/SetLoggerActor.php(28): Laminas\Stratigility\Next->handle()
#8 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Kilowhat\Audit\Middlewares\SetLoggerActor->process()
#9 /var/www/ss14-forum/vendor/nearata/flarum-ext-maintenance-mode/src/Middleware/AbstractMiddleware.php(50): Laminas\Stratigility\Next->handle()
#10 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Nearata\MaintenanceMode\Middleware\AbstractMiddleware->process()
#11 /var/www/ss14-forum/vendor/fof/oauth/src/Middleware/BindRequest.php(33): Laminas\Stratigility\Next->handle()
#12 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): FoF\OAuth\Middleware\BindRequest->process()
#13 /var/www/ss14-forum/vendor/flarum/core/src/Api/Middleware/ThrottleApi.php(33): Laminas\Stratigility\Next->handle()
#14 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Api\Middleware\ThrottleApi->process()
#15 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(36): Laminas\Stratigility\Next->handle()
#16 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\CheckCsrfToken->process()
#17 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(69): Laminas\Stratigility\Next->handle()
#18 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ResolveRoute->process()
#19 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/SetLocale.php(51): Laminas\Stratigility\Next->handle()
#20 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\SetLocale->process()
#21 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithHeader.php(58): Laminas\Stratigility\Next->handle()
#22 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\AuthenticateWithHeader->process()
#23 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(31): Laminas\Stratigility\Next->handle()
#24 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\AuthenticateWithSession->process()
#25 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(52): Laminas\Stratigility\Next->handle()
#26 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\RememberFromCookie->process()
#27 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle()
#28 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\StartSession->process()
#29 /var/www/ss14-forum/vendor/flarum/core/src/Api/Middleware/FakeHttpMethods.php(29): Laminas\Stratigility\Next->handle()
#30 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Api\Middleware\FakeHttpMethods->process()
#31 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle()
#32 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ParseJsonBody->process()
#33 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle()
#34 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\HandleErrors->process()
#35 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/InjectActorReference.php(25): Laminas\Stratigility\Next->handle()
#36 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\InjectActorReference->process()
#37 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(75): Laminas\Stratigility\Next->handle()
#38 /var/www/ss14-forum/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process()
#39 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\RequestHandler->process()
#40 /var/www/ss14-forum/vendor/middlewares/base-path-router/src/BasePathRouter.php(99): Laminas\Stratigility\Next->handle()
#41 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\BasePathRouter->process()
#42 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(36): Laminas\Stratigility\Next->handle()
#43 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Laminas\Stratigility\Middleware\OriginalMessages->process()
#44 /var/www/ss14-forum/vendor/middlewares/base-path/src/BasePath.php(73): Laminas\Stratigility\Next->handle()
#45 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\BasePath->process()
#46 /var/www/ss14-forum/vendor/flarum/core/src/Http/Middleware/ProcessIp.php(24): Laminas\Stratigility\Next->handle()
#47 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ProcessIp->process()
#48 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(75): Laminas\Stratigility\Next->handle()
#49 /var/www/ss14-forum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(64): Laminas\Stratigility\MiddlewarePipe->process()
#50 /var/www/ss14-forum/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(73): Laminas\Stratigility\MiddlewarePipe->handle()
#51 /var/www/ss14-forum/vendor/flarum/core/src/Http/Server.php(45): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
#52 /var/www/ss14-forum/public/index.php(26): Flarum\Http\Server->listen()
#53 {main}
AruMoon commented 1 year ago

UPD: That's because of some discussions, not the tags

AruMoon commented 1 year ago

Now I know why that happens. The first posts in some discussions were deleted. Gamification is trying to find the first post of the discussion and fails, returning error. Modifying discussion's first post id to the actual post instead of null fixes it

JoZ3 commented 1 year ago

Hi, I confirmed what you say @AruMoon , I deleted the first post of a discussion (definitived delete) and the error happens. I changed the ID of the first post, as you indicated and it was solved.

imorland commented 11 months ago

This should now be addressed in 1.6.5